[bazel] Add executable for skslc
This ports the GN skia_executable [1] and adds third_party Bazel rules for spirv_cross, translated from [2]. spirv_cross, unlike spirv_tools, did not have pre-made Bazel rules. This binary compiles and links with bazelisk build //tools/skslc --config=clang [1]ad324a31e6/BUILD.gn (L712)
[2]ad324a31e6/third_party/spirv-cross/BUILD.gn (L10)
Change-Id: I4abd51889552153fc7e64a5f7f3d9f0f597524e7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528044 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
7c18d94692
commit
a9f6ceebed
2
.bazelrc
2
.bazelrc
@ -28,6 +28,8 @@ build --flag_alias=disable_effect_serialization=//bazel/common_config_settings:d
|
||||
build --flag_alias=enable_effect_serialization=no//bazel/common_config_settings:disable_effect_serialization
|
||||
build --flag_alias=enable_vma=//bazel/common_config_settings:use_vulkan_memory_allocator
|
||||
build --flag_alias=disable_vma=no//bazel/common_config_settings:use_vulkan_memory_allocator
|
||||
build --flag_alias=enable_skslc=//bazel/common_config_settings:enable_skslc
|
||||
build --flag_alias=disable_skslc=no//bazel/common_config_settings:enable_skslc
|
||||
|
||||
# CanvasKit flags
|
||||
build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts
|
||||
|
@ -25,6 +25,14 @@ GENERAL_DEFINES = [
|
||||
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"//bazel/common_config_settings:enable_skslc_true": [
|
||||
"SKSL_STANDALONE",
|
||||
"SK_DISABLE_TRACING",
|
||||
"SK_ENABLE_SPIRV_CROSS",
|
||||
"SK_ENABLE_SPIRV_VALIDATION",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
GPU_DEFINES = select({
|
||||
|
@ -22,6 +22,7 @@ known_good_builds:
|
||||
bazelisk build //:skia_core --config=clang
|
||||
bazelisk build //src/sksl/lex:sksllex --config=clang
|
||||
bazelisk build //tools/skdiff --config=clang
|
||||
bazelisk build //tools/skslc --config=clang
|
||||
bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode opt --sandbox_base=/dev/shm
|
||||
|
||||
# Test the enforcement of include what you use
|
||||
@ -41,6 +42,7 @@ rbe_known_good_builds:
|
||||
bazelisk build //:skia_core --config=linux-rbe
|
||||
bazelisk build //src/sksl/lex:sksllex --config=linux-rbe
|
||||
bazelisk build //tools/skdiff --config=linux-rbe
|
||||
bazelisk build //tools/skslc --config=linux-rbe
|
||||
# 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 \
|
||||
|
@ -7,8 +7,9 @@ It is based off of https://github.com/bazelbuild/examples/tree/main/rules/starla
|
||||
"""
|
||||
|
||||
_bool_flags = [
|
||||
"//bazel/common_config_settings:use_icu",
|
||||
"//bazel/common_config_settings:enable_skslc",
|
||||
"//bazel/common_config_settings:is_skia_dev_build",
|
||||
"//bazel/common_config_settings:use_icu",
|
||||
]
|
||||
|
||||
_string_flags = [
|
||||
|
@ -207,3 +207,9 @@ bool_flag(
|
||||
flag_name = "use_vulkan_memory_allocator",
|
||||
public = False, # Users should use :vulkan_with_vma
|
||||
)
|
||||
|
||||
bool_flag(
|
||||
default = False,
|
||||
flag_name = "enable_skslc",
|
||||
)
|
||||
|
||||
|
@ -109,6 +109,7 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "osfile",
|
||||
visibility = ["//tools/skslc:__pkg__"],
|
||||
deps = [":SkOSFile_stdio_src"] + select({
|
||||
"@platforms//os:windows": [":SkOSFile_win_src"],
|
||||
"//conditions:default": [":SkOSFile_posix_src"],
|
||||
|
@ -117,6 +117,37 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "skslc_deps",
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//src/core:SkArenaAlloc_src",
|
||||
"//src/core:SkBlockAllocator_src",
|
||||
"//src/core:SkCpu_src",
|
||||
"//src/core:SkData_src",
|
||||
"//src/core:SkHalf_src",
|
||||
"//src/core:SkMalloc_src",
|
||||
"//src/core:SkMath_src",
|
||||
"//src/core:SkMatrixInvert_src",
|
||||
"//src/core:SkSemaphore_src",
|
||||
"//src/core:SkStream_src",
|
||||
"//src/core:SkStringUtils_src",
|
||||
"//src/core:SkString_src",
|
||||
"//src/core:SkThreadID_src",
|
||||
"//src/core:SkUtils_src",
|
||||
"//src/core:SkVM_src",
|
||||
"//src/gpu/ganesh:GrMemoryPool_src",
|
||||
"//src/ports:SkMemory_malloc_src",
|
||||
"//src/ports:SkOSFile_stdio_src",
|
||||
"//src/utils:SkJSONWriter_src",
|
||||
"//src/utils:SkJSON_src",
|
||||
"//src/utils:SkParse_src",
|
||||
"//src/utils:SkShaderUtils_src",
|
||||
"//src/utils:SkUTF_src",
|
||||
"//src/utils:SkVMVisualizer_src",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GLSL.std.450_hdr",
|
||||
hdrs = ["GLSL.std.450.h"],
|
||||
@ -270,6 +301,7 @@ generated_cc_atom(
|
||||
"//src/sksl/ir:SkSLVariableReference_hdr",
|
||||
"//src/sksl/ir:SkSLVariable_hdr",
|
||||
"//src/sksl/transform:SkSLTransform_hdr",
|
||||
"@spirv_tools",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -323,7 +323,10 @@ generated_cc_atom(
|
||||
name = "SkSLSPIRVtoHLSL_src",
|
||||
srcs = ["SkSLSPIRVtoHLSL.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [":SkSLSPIRVtoHLSL_hdr"],
|
||||
deps = [
|
||||
":SkSLSPIRVtoHLSL_hdr",
|
||||
"//third_party:spirv_cross",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
|
34
third_party/BUILD.bazel
vendored
34
third_party/BUILD.bazel
vendored
@ -3512,3 +3512,37 @@ cc_library(
|
||||
],
|
||||
visibility = ["//visibility:private"], # only used by :dawn
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "spirv_cross",
|
||||
srcs = [
|
||||
"externals/spirv-cross/GLSL.std.450.h",
|
||||
"externals/spirv-cross/spirv.hpp",
|
||||
"externals/spirv-cross/spirv_cfg.cpp",
|
||||
"externals/spirv-cross/spirv_cfg.hpp",
|
||||
"externals/spirv-cross/spirv_common.hpp",
|
||||
"externals/spirv-cross/spirv_cpp.cpp",
|
||||
"externals/spirv-cross/spirv_cpp.hpp",
|
||||
"externals/spirv-cross/spirv_cross.cpp",
|
||||
"externals/spirv-cross/spirv_cross.hpp",
|
||||
"externals/spirv-cross/spirv_cross_containers.hpp",
|
||||
"externals/spirv-cross/spirv_cross_error_handling.hpp",
|
||||
"externals/spirv-cross/spirv_cross_parsed_ir.cpp",
|
||||
"externals/spirv-cross/spirv_cross_parsed_ir.hpp",
|
||||
"externals/spirv-cross/spirv_glsl.cpp",
|
||||
"externals/spirv-cross/spirv_glsl.hpp",
|
||||
"externals/spirv-cross/spirv_hlsl.cpp",
|
||||
"externals/spirv-cross/spirv_msl.cpp",
|
||||
"externals/spirv-cross/spirv_msl.hpp",
|
||||
"externals/spirv-cross/spirv_parser.cpp",
|
||||
"externals/spirv-cross/spirv_parser.hpp",
|
||||
"externals/spirv-cross/spirv_reflect.cpp",
|
||||
"externals/spirv-cross/spirv_reflect.hpp",
|
||||
],
|
||||
hdrs = [
|
||||
"externals/spirv-cross/spirv_hlsl.hpp",
|
||||
],
|
||||
defines = ["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
|
4
third_party/file_map_for_bazel.json
vendored
4
third_party/file_map_for_bazel.json
vendored
@ -62,8 +62,8 @@
|
||||
|
||||
"sample/chromium/font_subsetter.h": "SK_GAZELLE_IGNORE TODO //third_party:sfntly",
|
||||
|
||||
"third_party/externals/spirv-cross/spirv_hlsl.hpp": "SK_GAZELLE_IGNORE TODO //third_party:spirv_cross",
|
||||
"spirv-tools/libspirv.hpp": "SK_GAZELLE_IGNORE TODO //third_party:spirv_tools",
|
||||
"third_party/externals/spirv-cross/spirv_hlsl.hpp": "//third_party:spirv_cross",
|
||||
"spirv-tools/libspirv.hpp": "@spirv_tools//:spirv_tools",
|
||||
|
||||
"vk_platform.h": "//include/third_party/vulkan/vulkan:vk_platform_hdr",
|
||||
"vulkan_android.h": "//include/third_party/vulkan/vulkan:vulkan_android_hdr",
|
||||
|
@ -1,4 +1,19 @@
|
||||
load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
|
||||
load("//bazel:macros.bzl", "generated_cc_atom")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
|
||||
cc_binary_with_flags(
|
||||
name = "skslc",
|
||||
set_flags = {
|
||||
"enable_skslc": ["True"],
|
||||
},
|
||||
deps = [
|
||||
":Main_src",
|
||||
"//src/ports:osfile",
|
||||
"//src/sksl:skslc_deps",
|
||||
"//src/sksl:srcs",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "Main_src",
|
||||
@ -23,5 +38,6 @@ generated_cc_atom(
|
||||
"//src/sksl/tracing:SkVMDebugTrace_hdr",
|
||||
"//src/utils:SkShaderUtils_hdr",
|
||||
"//src/utils:SkVMVisualizer_hdr",
|
||||
"@spirv_tools",
|
||||
],
|
||||
)
|
||||
|
@ -462,6 +462,7 @@ generated_cc_atom(
|
||||
"//tools/flags:CommandLineFlags_hdr",
|
||||
"//tools/flags:CommonFlags_hdr",
|
||||
"//tools/trace:EventTracingPriv_hdr",
|
||||
"@spirv_tools",
|
||||
],
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user