888d4efa77
This re-works src/ports/BUILD.bazel to work like our other BUILD files, i.e. one rule "srcs" that brings in the necessary private filegroups. To work around an abort with LLVM [1], we have to go back to an earlier version of emscripten (temporarily?). Future work should look at using transitions [2] to allow various executables (e.g. CanvasKit, DM) to set their own set of Bazel flags, w/o the build invokers having to specify them. These transitions might be able to handle more complex cases that we currently use if statements in GN to deal with. The Freetype build rule was created by taking the BUILD.gn rule, adding in all the sources listed there and then playing compile-whack-a-mole to add in all the headers and included .c files. Suggested Review Order: - third_party/BUILD.bazel to see freetype build rules - bazel/common_config_settings/ to see treatment of fontmgr like codecs (many possible) and fontmgr_factory (only one). - src/ports/BUILD.bazel - BUILD.bazel - modules/canvaskit/BUILD.bazel. Take note of the gen_rule that calls tools/embed_resources.py to produce the .cpp file containing the embedded font data. - Everything else. [1] https://github.com/emscripten-core/emscripten/issues/15528 [2] https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts Bug: skia:12541 Change-Id: I08dab82a901d80507007b354ca20cbfad2c2388f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471636 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
126 lines
3.2 KiB
Python
126 lines
3.2 KiB
Python
load(":defs.bzl", "string_flag_with_values")
|
|
|
|
# @platforms is found at https://github.com/bazelbuild/platforms
|
|
package(default_visibility = ["//:__subpackages__"])
|
|
|
|
config_setting(
|
|
name = "linux_x64",
|
|
constraint_values = [
|
|
"@platforms//cpu:x86_64",
|
|
"@platforms//os:linux",
|
|
],
|
|
)
|
|
|
|
config_setting(
|
|
name = "windows_x64",
|
|
constraint_values = [
|
|
"@platforms//cpu:x86_64",
|
|
"@platforms//os:windows",
|
|
],
|
|
)
|
|
|
|
config_setting(
|
|
name = "linux_arm64",
|
|
constraint_values = [
|
|
"@platforms//cpu:arm64",
|
|
"@platforms//os:linux",
|
|
],
|
|
)
|
|
|
|
config_setting(
|
|
name = "debug_build",
|
|
values = {"compilation_mode": "dbg"},
|
|
)
|
|
|
|
config_setting(
|
|
name = "release_build",
|
|
values = {"compilation_mode": "opt"},
|
|
)
|
|
|
|
constraint_value(
|
|
name = "fuchsia",
|
|
constraint_setting = "@platforms//os:os",
|
|
)
|
|
|
|
config_setting(
|
|
name = "fuchsia_arm64",
|
|
constraint_values = [
|
|
"@platforms//cpu:arm64",
|
|
":fuchsia",
|
|
],
|
|
)
|
|
|
|
# We define this here because the emscripten toolchain calls the cpu wasm, whereas the
|
|
# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919
|
|
config_setting(
|
|
name = "cpu_wasm",
|
|
values = {
|
|
"cpu": "wasm",
|
|
},
|
|
)
|
|
|
|
# =============================================================================
|
|
# Configurable Skia Features
|
|
# =============================================================================
|
|
# These are flags that we can specify when invoking bazel build to turn on and
|
|
# off certain features, such as GPU backend, or codec support.
|
|
# https://docs.bazel.build/versions/4.2.1/skylark/config.html#using-build-settings-on-the-command-line
|
|
# For example, to use the GL backend with the WebGL flavor, one would run
|
|
# bazel build //:skia-core --//bazel/common_config_settings:gpu_backend=gl_backend \
|
|
# --//bazel/common_config_settings:with_gl_standard=webgl_standard
|
|
# This is a bit wordy, so we define aliases in the //.bazelrc file that condense this to
|
|
# bazel build //:skia-core --gpu_backend=gl_backend --with_gl_standard=webgl_standard
|
|
#
|
|
# Developers can specify their own short-hands by making a .bazelrc file in their home
|
|
# directory. https://docs.bazel.build/versions/main/guide.html#where-are-the-bazelrc-files
|
|
#
|
|
|
|
string_flag_with_values(
|
|
flag_name = "gpu_backend",
|
|
multiple = True,
|
|
values = [
|
|
"gl_backend",
|
|
"vulkan_backend",
|
|
],
|
|
)
|
|
|
|
string_flag_with_values(
|
|
flag_name = "with_gl_standard",
|
|
values = [
|
|
"gles_standard",
|
|
"gl_standard",
|
|
"webgl_standard",
|
|
],
|
|
)
|
|
|
|
string_flag_with_values(
|
|
default = "empty_fontmgr_factory",
|
|
flag_name = "fontmgr_factory",
|
|
values = [
|
|
"empty_fontmgr_factory",
|
|
"custom_embedded_fontmgr_factory",
|
|
],
|
|
)
|
|
|
|
string_flag_with_values(
|
|
flag_name = "include_fontmgr",
|
|
multiple = True,
|
|
values = [
|
|
"custom_directory_fontmgr",
|
|
"custom_embedded_fontmgr",
|
|
"custom_empty_fontmgr",
|
|
],
|
|
)
|
|
|
|
string_flag_with_values(
|
|
flag_name = "include_codec",
|
|
multiple = True,
|
|
values = [
|
|
"gif_codec",
|
|
"jpeg_codec",
|
|
"png_codec",
|
|
"raw_codec",
|
|
"webp_codec",
|
|
],
|
|
)
|