diff --git a/bazel/Makefile b/bazel/Makefile index 09c96a47a2..370d75f80d 100644 --- a/bazel/Makefile +++ b/bazel/Makefile @@ -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 \ diff --git a/src/core/SkKeyContext.h b/src/core/SkKeyContext.h index 8e770214df..6c4640885e 100644 --- a/src/core/SkKeyContext.h +++ b/src/core/SkKeyContext.h @@ -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" diff --git a/src/sksl/BUILD.bazel b/src/sksl/BUILD.bazel index 5ba90f5f81..54b3daaa3b 100644 --- a/src/sksl/BUILD.bazel +++ b/src/sksl/BUILD.bazel @@ -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__"], ) diff --git a/src/sksl/codegen/BUILD.bazel b/src/sksl/codegen/BUILD.bazel index 16959e423e..749688582a 100644 --- a/src/sksl/codegen/BUILD.bazel +++ b/src/sksl/codegen/BUILD.bazel @@ -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": [], }), ) diff --git a/src/sksl/lex/BUILD.bazel b/src/sksl/lex/BUILD.bazel new file mode 100644 index 0000000000..6b6ba1ca9d --- /dev/null +++ b/src/sksl/lex/BUILD.bazel @@ -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 diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 69666adff2..79af968053 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -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", + ], +) diff --git a/tools/flags/BUILD.bazel b/tools/flags/BUILD.bazel new file mode 100644 index 0000000000..0172e8e532 --- /dev/null +++ b/tools/flags/BUILD.bazel @@ -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__"], +) diff --git a/tools/fonts/BUILD.bazel b/tools/fonts/BUILD.bazel new file mode 100644 index 0000000000..692f4ed7df --- /dev/null +++ b/tools/fonts/BUILD.bazel @@ -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__"], +) diff --git a/tools/skdiff/BUILD.bazel b/tools/skdiff/BUILD.bazel new file mode 100644 index 0000000000..f8725a5eb0 --- /dev/null +++ b/tools/skdiff/BUILD.bazel @@ -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", + ], +) diff --git a/tools/skslc/BUILD.bazel b/tools/skslc/BUILD.bazel new file mode 100644 index 0000000000..f317b0848d --- /dev/null +++ b/tools/skslc/BUILD.bazel @@ -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", + ], +)