[bazel] Add new rules for various tools
This adds or fixes rules to build three binaries that previously had Bazel support. How we build skslc with Bazel differs from GN in a large way: GN has a small set of C++ files [1] it compiles in, but with Bazel that was too hard/clumsy to pipe through (and get the headers to work well). So, I just had skslc depend on //:skia_core for simplicity. skslc did need to include something in //src, so I made a special filegroup for it. For more complex executables that need more headers from //src, we should probably make a "src_hdrs" filegroup or something to expose those. That or a skia_for_tests cc_library that has all headers as "public". [1] https://github.com/google/skia/blob/main/gn/sksl.gni#L235 Change-Id: Ie1382e982228059369886f4bfef4947f686b11b5 Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544637 Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
956704b387
commit
5810c7ad0b
@ -17,9 +17,9 @@ known_good_builds:
|
||||
bazelisk build //example:hello_world_vulkan --config=clang_linux
|
||||
bazelisk build //example:hello_world_dawn --config=clang_linux
|
||||
bazelisk build //example:vulkan_basic --config=clang_linux
|
||||
#bazelisk build //src/sksl/lex:sksllex --config=clang_linux
|
||||
#bazelisk build //tools/skdiff --config=clang_linux
|
||||
#bazelisk build //tools/skslc --config=clang_linux
|
||||
bazelisk build //src/sksl/lex:sksllex --config=clang_linux
|
||||
bazelisk build //tools/skdiff --config=clang_linux
|
||||
bazelisk build //tools/skslc --config=clang_linux
|
||||
#bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode opt --sandbox_base=/dev/shm
|
||||
|
||||
rbe_known_good_builds:
|
||||
@ -30,9 +30,9 @@ rbe_known_good_builds:
|
||||
bazelisk build //example:hello_world_vulkan --config=linux_rbe --remote_download_minimal
|
||||
bazelisk build //example:hello_world_dawn --config=linux_rbe --remote_download_minimal
|
||||
bazelisk build //example:vulkan_basic --config=linux_rbe --remote_download_minimal
|
||||
#bazelisk build //src/sksl/lex:sksllex --config=linux_rbe --remote_download_minimal
|
||||
#bazelisk build //tools/skdiff --config=linux_rbe --remote_download_minimal
|
||||
#bazelisk build //tools/skslc --config=linux_rbe --remote_download_minimal
|
||||
bazelisk build //src/sksl/lex:sksllex --config=linux_rbe --remote_download_minimal
|
||||
bazelisk build //tools/skdiff --config=linux_rbe --remote_download_minimal
|
||||
bazelisk build //tools/skslc --config=linux_rbe --remote_download_minimal
|
||||
## TODO(kjlubick) CanvasKit in release mode (i.e. with Closure) requires
|
||||
## https://github.com/emscripten-core/emscripten/pull/16640 to land
|
||||
#bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode dbg --config=linux_rbe \
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef SkKeyContext_DEFINED
|
||||
#define SkKeyContext_DEFINED
|
||||
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
#include "include/core/SkM44.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
|
||||
load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "selects")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
@ -80,6 +80,14 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "use_sksl_gpu_srcs",
|
||||
match_any = [
|
||||
"//bazel/common_config_settings:has_gpu_backend",
|
||||
"//bazel/common_config_settings:enable_skslc_true",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = [
|
||||
@ -91,7 +99,7 @@ filegroup(
|
||||
"//src/sksl/tracing:srcs",
|
||||
"//src/sksl/transform:srcs",
|
||||
] + select({
|
||||
"//bazel/common_config_settings:has_gpu_backend": [":gpu_srcs"],
|
||||
":use_sksl_gpu_srcs": [":gpu_srcs"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//src:__pkg__"],
|
||||
@ -105,5 +113,19 @@ cc_library(
|
||||
visibility = ["//src:__pkg__"],
|
||||
deps = [
|
||||
"//src/sksl/codegen:deps",
|
||||
],
|
||||
] + select({
|
||||
"//bazel/common_config_settings:enable_skslc_true": [
|
||||
"@spirv_tools",
|
||||
"@dawn//:tint",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "skslc_hdrs",
|
||||
srcs = [
|
||||
"SkSLCompiler.h",
|
||||
],
|
||||
visibility = ["//tools/skslc:__pkg__"],
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ filegroup(
|
||||
srcs = [
|
||||
":core_srcs",
|
||||
] + select({
|
||||
"//bazel/common_config_settings:has_gpu_backend": [":gpu_srcs"],
|
||||
"//src/sksl:use_sksl_gpu_srcs": [":gpu_srcs"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//src/sksl:__pkg__"],
|
||||
@ -46,7 +46,7 @@ cc_library(
|
||||
name = "deps",
|
||||
visibility = ["//src/sksl:__pkg__"],
|
||||
deps = select({
|
||||
"//bazel/common_config_settings:has_gpu_backend": ["//third_party:spirv_cross"],
|
||||
"//src/sksl:use_sksl_gpu_srcs": ["//third_party:spirv_cross"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
27
src/sksl/lex/BUILD.bazel
Normal file
27
src/sksl/lex/BUILD.bazel
Normal file
@ -0,0 +1,27 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
cc_binary(
|
||||
name = "sksllex",
|
||||
srcs = [
|
||||
"DFA.h",
|
||||
"DFAState.h",
|
||||
"LexUtil.h",
|
||||
"Main.cpp",
|
||||
"NFA.cpp",
|
||||
"NFA.h",
|
||||
"NFAState.h",
|
||||
"NFAtoDFA.h",
|
||||
"RegexNode.cpp",
|
||||
"RegexNode.h",
|
||||
"RegexParser.cpp",
|
||||
"RegexParser.h",
|
||||
"TransitionTable.cpp",
|
||||
"TransitionTable.h",
|
||||
],
|
||||
)
|
||||
|
||||
# TODO(kjlubick) we'll need to have a gen_rule or similar to replace //gn/run_sksllex.py
|
@ -1,5 +1,29 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
cc_library(
|
||||
name = "tool_utils",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"Resources.cpp",
|
||||
"ToolUtils.cpp",
|
||||
"ResourceFactory.h",
|
||||
"Resources.h",
|
||||
"//tools/flags:core_srcs",
|
||||
# TODO(kjlubick, bungeman): We should split out the font stuff into its own set of files
|
||||
"//tools/fonts:test_font_manager_srcs",
|
||||
],
|
||||
hdrs = [
|
||||
"ToolUtils.h",
|
||||
],
|
||||
textual_hdrs = [
|
||||
"//tools/fonts:test_fonts",
|
||||
],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//:skia_core",
|
||||
],
|
||||
)
|
||||
|
15
tools/flags/BUILD.bazel
Normal file
15
tools/flags/BUILD.bazel
Normal file
@ -0,0 +1,15 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
filegroup(
|
||||
name = "core_srcs",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"CommandLineFlags.cpp",
|
||||
"CommandLineFlags.h",
|
||||
],
|
||||
visibility = ["//tools:__subpackages__"],
|
||||
)
|
30
tools/fonts/BUILD.bazel
Normal file
30
tools/fonts/BUILD.bazel
Normal file
@ -0,0 +1,30 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
filegroup(
|
||||
name = "test_font_manager_srcs",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"TestFontMgr.cpp",
|
||||
"TestFontMgr.h",
|
||||
"TestTypeface.cpp",
|
||||
"TestTypeface.h",
|
||||
"ToolUtilsFont.cpp",
|
||||
],
|
||||
visibility = ["//tools:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "test_fonts",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"test_font_index.inc",
|
||||
"test_font_monospace.inc",
|
||||
"test_font_sans_serif.inc",
|
||||
"test_font_serif.inc",
|
||||
],
|
||||
visibility = ["//tools:__subpackages__"],
|
||||
)
|
23
tools/skdiff/BUILD.bazel
Normal file
23
tools/skdiff/BUILD.bazel
Normal file
@ -0,0 +1,23 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
cc_binary(
|
||||
name = "skdiff",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"skdiff.cpp",
|
||||
"skdiff.h",
|
||||
"skdiff_html.cpp",
|
||||
"skdiff_html.h",
|
||||
"skdiff_main.cpp",
|
||||
"skdiff_utils.cpp",
|
||||
"skdiff_utils.h",
|
||||
],
|
||||
deps = [
|
||||
"//:skia_core",
|
||||
"//tools:tool_utils",
|
||||
],
|
||||
)
|
22
tools/skslc/BUILD.bazel
Normal file
22
tools/skslc/BUILD.bazel
Normal file
@ -0,0 +1,22 @@
|
||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||
load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files_legacy()
|
||||
|
||||
cc_binary_with_flags(
|
||||
name = "skslc",
|
||||
srcs = [
|
||||
"Main.cpp",
|
||||
"//src/sksl:skslc_hdrs",
|
||||
],
|
||||
set_flags = {
|
||||
"enable_sksl": ["True"],
|
||||
"enable_skslc": ["True"],
|
||||
},
|
||||
deps = [
|
||||
"//:skia_core",
|
||||
"@spirv_tools",
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user