8ed49ea6e3
This ports the third_party BUILD.gn files related to codecs (with a best-effort on arm/SIMD stuff). This includes: - libpng - libjpeg-turbo - libwebp - wuffs (gif) - libgifcodec - dng_sdk and piex (raw codec) This expands the string_flag_with_values macro to allow multiple values to be set at once. This was added in Bazel 5.0.0, however the latest pre-release version of that has a bug [1] which slows down compilation dramatically. This was fixed at ToT, but not released. As a result, I started using the Bazel 6 pre-release (via bazelisk). The macro select_multi makes writing select() where multiple elements could be on possible/easier. One can try compiling certain codecs by running: bazel build :skia-core --config clang --include_codec=raw_codec --include_codec=png_codec Suggested Review Order: - bazel/macros.bzl - bazel/common_config_settings/defs.bzl and its BUILD.bazel to see how the codec options are defined. - BUILD.bazel to see how the codec settings are used. - src/codec/BUILD.bazel to see the inclusion of Skia files to deal with specific codecs. - third_party/BUILD.bazel (while referencing the corresponding BUILD.gn files, such as third_party/libwebp/BUILD.gn) - Everything else. Change-Id: I797375a35fa345d9835e7b2a2ab23371c45953c3 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469456 Reviewed-by: Leandro Lovisolo <lovisolo@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
116 lines
3.0 KiB
Python
116 lines
3.0 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_directory_fontmgr_factory",
|
|
],
|
|
)
|
|
|
|
string_flag_with_values(
|
|
flag_name = "include_codec",
|
|
multiple = True,
|
|
values = [
|
|
"gif_codec",
|
|
"jpeg_codec",
|
|
"png_codec",
|
|
"raw_codec",
|
|
"webp_codec",
|
|
],
|
|
)
|