e4047903db
I think they read better when it is enable_foo. I have to do less double-negation in my head if they are set to false then. Reland of https://skia-review.googlesource.com/c/skia/+/528838 Change-Id: I15075687cbee98b41364518384b656e897d716d8 Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529276 Reviewed-by: Ben Wagner <bungeman@google.com>
121 lines
3.8 KiB
Python
121 lines
3.8 KiB
Python
load("//bazel:macros.bzl", "select_multi")
|
|
|
|
GENERAL_DEFINES = [
|
|
"SK_HAS_ANDROID_CODEC",
|
|
"SKIA_IMPLEMENTATION=1",
|
|
] + select({
|
|
"//bazel/common_config_settings:debug_build": [
|
|
"SK_DEBUG",
|
|
],
|
|
"//bazel/common_config_settings:release_build": [
|
|
"SK_RELEASE",
|
|
],
|
|
"//conditions:default": [
|
|
"SK_RELEASE",
|
|
],
|
|
}) + select({
|
|
"//bazel/common_config_settings:enable_tracing_false": ["SK_DISABLE_TRACING"],
|
|
"//conditions:default": [],
|
|
}) + select({
|
|
"//bazel/common_config_settings:enable_effect_serialization_false": ["SK_DISABLE_EFFECT_DESERIALIZATION"],
|
|
"//conditions:default": [],
|
|
}) + select({
|
|
"//bazel/common_config_settings:is_skia_dev_build_true": [
|
|
"GR_TEST_UTILS=1",
|
|
"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({
|
|
"//bazel/common_config_settings:gl_backend": [
|
|
"SK_GL",
|
|
"SK_SUPPORT_GPU=1",
|
|
],
|
|
"//bazel/common_config_settings:vulkan_backend": [
|
|
"SK_VULKAN",
|
|
"SK_SUPPORT_GPU=1",
|
|
],
|
|
"//bazel/common_config_settings:dawn_backend": [
|
|
"SK_DAWN",
|
|
"SK_SUPPORT_GPU=1",
|
|
"VK_USE_PLATFORM_XCB_KHR", # TODO(kjlubick) support dawn's dawn_enable_vulkan etc
|
|
],
|
|
"//conditions:default": [
|
|
"SK_SUPPORT_GPU=0",
|
|
],
|
|
}) + select({
|
|
"//bazel/common_config_settings:gl_standard": [
|
|
"SK_ASSUME_GL=1",
|
|
],
|
|
"//bazel/common_config_settings:gles_standard": [
|
|
"SK_ASSUME_GL_ES=1",
|
|
],
|
|
"//bazel/common_config_settings:webgl_standard": [
|
|
"SK_ASSUME_WEBGL=1",
|
|
"SK_USE_WEBGL",
|
|
],
|
|
"//conditions:default": [],
|
|
}) + select({
|
|
"//bazel/common_config_settings:vulkan_with_vma": [
|
|
"SK_USE_VMA",
|
|
],
|
|
"//conditions:default": [],
|
|
})
|
|
|
|
CODEC_DEFINES = select_multi(
|
|
{
|
|
"//bazel/common_config_settings:gif_decode_codec": ["SK_HAS_WUFFS_LIBRARY"],
|
|
"//bazel/common_config_settings:jpeg_decode_codec": ["SK_CODEC_DECODES_JPEG"],
|
|
"//bazel/common_config_settings:jpeg_encode_codec": ["SK_ENCODE_JPEG"],
|
|
"//bazel/common_config_settings:png_decode_codec": ["SK_CODEC_DECODES_PNG"],
|
|
"//bazel/common_config_settings:png_encode_codec": ["SK_ENCODE_PNG"],
|
|
"//bazel/common_config_settings:raw_decode_codec": [
|
|
"SK_CODEC_DECODES_RAW",
|
|
"SK_CODEC_DECODES_JPEG",
|
|
],
|
|
"//bazel/common_config_settings:webp_decode_codec": ["SK_CODEC_DECODES_WEBP"],
|
|
"//bazel/common_config_settings:webp_encode_codec": ["SK_ENCODE_WEBP"],
|
|
},
|
|
default = [],
|
|
)
|
|
|
|
PLATFORM_DEFINES = select({
|
|
"//bazel/common_config_settings:cpu_wasm": [
|
|
# working around https://github.com/emscripten-core/emscripten/issues/10072
|
|
"SK_FORCE_8_BYTE_ALIGNMENT",
|
|
"SK_DISABLE_LEGACY_SHADERCONTEXT",
|
|
"SK_DISABLE_AAA", # This saves about 57KB of code size, uncompressed
|
|
"SK_NO_COMMAND_BUFFER", # not a feature CK needs.
|
|
],
|
|
"//conditions:default": [],
|
|
})
|
|
|
|
SHAPER_DEFINES = select_multi(
|
|
{
|
|
"//bazel/common_config_settings:coretext_shaper": ["SK_SHAPER_CORETEXT_AVAILABLE"],
|
|
"//bazel/common_config_settings:harfbuzz_shaper": ["SK_SHAPER_HARFBUZZ_AVAILABLE"],
|
|
},
|
|
default = [],
|
|
)
|
|
|
|
UNICODE_DEFINES = select({
|
|
"//bazel/common_config_settings:use_icu_true": ["SK_UNICODE_AVAILABLE"],
|
|
"//conditions:default": [],
|
|
})
|
|
|
|
cc_library(
|
|
name = "defines_from_flags",
|
|
defines = GENERAL_DEFINES + GPU_DEFINES + CODEC_DEFINES + PLATFORM_DEFINES +
|
|
SHAPER_DEFINES + UNICODE_DEFINES,
|
|
visibility = ["//:__subpackages__"],
|
|
)
|