1load(":defs.bzl", "string_flag_with_values") 2 3# @platforms is found at https://github.com/bazelbuild/platforms 4package(default_visibility = ["//:__subpackages__"]) 5 6config_setting( 7 name = "linux_x64", 8 constraint_values = [ 9 "@platforms//cpu:x86_64", 10 "@platforms//os:linux", 11 ], 12) 13 14config_setting( 15 name = "windows_x64", 16 constraint_values = [ 17 "@platforms//cpu:x86_64", 18 "@platforms//os:windows", 19 ], 20) 21 22config_setting( 23 name = "linux_arm64", 24 constraint_values = [ 25 "@platforms//cpu:arm64", 26 "@platforms//os:linux", 27 ], 28) 29 30config_setting( 31 name = "debug_build", 32 values = {"compilation_mode": "dbg"}, 33) 34 35config_setting( 36 name = "release_build", 37 values = {"compilation_mode": "opt"}, 38) 39 40constraint_value( 41 name = "fuchsia", 42 constraint_setting = "@platforms//os:os", 43) 44 45config_setting( 46 name = "fuchsia_arm64", 47 constraint_values = [ 48 "@platforms//cpu:arm64", 49 ":fuchsia", 50 ], 51) 52 53# We define this here because the emscripten toolchain calls the cpu wasm, whereas the 54# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919 55config_setting( 56 name = "cpu_wasm", 57 values = { 58 "cpu": "wasm", 59 }, 60) 61 62# ============================================================================= 63# Configurable Skia Features 64# ============================================================================= 65# These are flags that we can specify when invoking bazel build to turn on and 66# off certain features, such as GPU backend, or codec support. 67# https://docs.bazel.build/versions/4.2.1/skylark/config.html#using-build-settings-on-the-command-line 68# For example, to use the GL backend with the WebGL flavor, one would run 69# bazel build //:skia-core --//bazel/common_config_settings:gpu_backend=gl_backend \ 70# --//bazel/common_config_settings:with_gl_standard=webgl_standard 71# This is a bit wordy, so we define aliases in the //.bazelrc file that condense this to 72# bazel build //:skia-core --gpu_backend=gl_backend --with_gl_standard=webgl_standard 73# 74# Developers can specify their own short-hands by making a .bazelrc file in their home 75# directory. https://docs.bazel.build/versions/main/guide.html#where-are-the-bazelrc-files 76# 77 78string_flag_with_values( 79 flag_name = "gpu_backend", 80 multiple = True, 81 values = [ 82 "gl_backend", 83 "vulkan_backend", 84 ], 85) 86 87string_flag_with_values( 88 flag_name = "with_gl_standard", 89 values = [ 90 "gles_standard", 91 "gl_standard", 92 "webgl_standard", 93 ], 94) 95 96string_flag_with_values( 97 default = "empty_fontmgr_factory", 98 flag_name = "fontmgr_factory", 99 values = [ 100 "empty_fontmgr_factory", 101 "custom_directory_fontmgr_factory", 102 ], 103) 104 105string_flag_with_values( 106 flag_name = "include_codec", 107 multiple = True, 108 values = [ 109 "gif_codec", 110 "jpeg_codec", 111 "png_codec", 112 "raw_codec", 113 "webp_codec", 114 ], 115) 116