1# This file contains the build configurations of Skia that we use for testing on the CI. 2# These allow a short-form reference for our supported combinations of build features. 3# https://bazel.build/docs/bazelrc#config 4# 5# For most build configurations, we will want to set the --cc_output_directory_tag [1] 6# with a unique identifier per configuration name. 7# 8# By default, Bazel's "unique target BuildConfiguration" [2] incorporates the compilation_mode, 9# the target platform, and some suffixes to avoid Bazel-caused and user-caused conflicts. [3] [4] 10# For example, a default output directory might look like "k8-fastbuild-ST-6a54c1377847". 11# Inside this output directory is a subfolder for the target (e.g. executable) name. 12# 13# Note that multiple definitions of a config are allowed - in this event, they are added together. 14# This is handy if we need to comment on why certain settings are necessary. Otherwise, escaping 15# the trailing newline (and thus having a multi-line definition) is preferred for brevity. 16# 17# Notably, the flags that we turn on and off via //bazel/common_config_settings do not affect 18# the output directory. The output directory is used to store compiled object files (.o files) 19# and generated dependency files (e.g. the output of clang --write-dependencies [5]), so having 20# these be overwritten unnecessarily will slow down incremental rebuilds when switching between 21# building different configurations of the same targets. 22# 23# [1] https://bazel.build/reference/command-line-reference#flag--cc_output_directory_tag 24# [2] https://bazel.build/docs/output_directories#layout-diagram 25# [3] https://github.com/bazelbuild/bazel/blob/ad37a3748c78e0ee903b56366322c70ab8b22187/CODEBASE.md#the-structure-of-the-output-directory 26# [4] https://github.com/bazelbuild/bazel/blob/e0e589658463beb9605030b4820dcc97e6a36f48/src/main/java/com/google/devtools/build/lib/analysis/config/OutputDirectories.java#L198-L236 27# [5] https://clang.llvm.org/docs/ClangCommandLineReference.html#dependency-file-generation 28 29# ============================================================================= 30# Targets (what to build for) 31# ============================================================================= 32 33# --platforms refers to the target for which we are compiling. By setting the target to be a 34# platform which has our own custom constraint_setting and constraint_value 35# (skia_hermetic_toolchain=use_hermetic_toolchain), this causes Bazel to resolve the toolchain 36# to be our hermetic one because our hermetic toolchains have that same constraint set in their 37# target_compatible_with list. 38build:for_linux_x64_debug --platforms=//bazel/platform:linux_x64_hermetic \ 39 --compilation_mode=dbg \ 40 --cc_output_directory_tag=linux_x64_debug 41build:for_linux_x64_release --platforms=//bazel/platform:linux_x64_hermetic \ 42 --compilation_mode=opt \ 43 --cc_output_directory_tag=linux_x64_release 44build:for_linux_x64_fastbuild --platforms=//bazel/platform:linux_x64_hermetic \ 45 --compilation_mode=fastbuild \ 46 --cc_output_directory_tag=linux_x64_fastbuild 47 48build:for_linux_x64_debug_with_rbe --config=for_linux_x64_debug --config=linux_rbe 49build:for_linux_x64_release_with_rbe --config=for_linux_x64_release --config=linux_rbe 50build:for_linux_x64_fastbuild_with_rbe --config=for_linux_x64_fastbuild --config=linux_rbe 51 52# Shorter config names defaulting to fastbuild (same default as --compilation_mode, see 53# https://bazel.build/docs/user-manual#compilation-mode). 54build:for_linux_x64 --config=for_linux_x64_fastbuild 55build:for_linux_x64_with_rbe --config=for_linux_x64_fastbuild_with_rbe 56 57build:for_mac_arm64_debug --platforms=//bazel/platform:mac_arm64_hermetic \ 58 --compilation_mode=dbg \ 59 --cc_output_directory_tag=mac_arm64_debug 60build:for_mac_arm64_release --platforms=//bazel/platform:mac_arm64_hermetic \ 61 --compilation_mode=opt \ 62 --cc_output_directory_tag=mac_arm64_release 63build:for_mac_arm64_fastbuild --platforms=//bazel/platform:mac_arm64_hermetic \ 64 --compilation_mode=fastbuild \ 65 --cc_output_directory_tag=mac_arm64_fastbuild 66 67build:for_mac_x64_debug --platforms=//bazel/platform:mac_x64_hermetic \ 68 --compilation_mode=dbg \ 69 --cc_output_directory_tag=mac_x64_debug 70build:for_mac_x64_release --platforms=//bazel/platform:mac_x64_hermetic \ 71 --compilation_mode=opt \ 72 --cc_output_directory_tag=mac_x64_release 73build:for_mac_x64_fastbuild --platforms=//bazel/platform:mac_x64_hermetic \ 74 --compilation_mode=fastbuild \ 75 --cc_output_directory_tag=mac_x64_fastbuild 76 77build:for_windows_x64_debug --platforms=//bazel/platform:windows_x64_hermetic \ 78 --compilation_mode=dbg \ 79 --cc_output_directory_tag=windows_x64_debug 80build:for_windows_x64_release --platforms=//bazel/platform:windows_x64_hermetic \ 81 --compilation_mode=opt \ 82 --cc_output_directory_tag=windows_x64_release 83build:for_windows_x64_fastbuild --platforms=//bazel/platform:windows_x64_hermetic \ 84 --compilation_mode=fastbuild \ 85 --cc_output_directory_tag=windows_x64_fastbuild 86 87# Shorter config names defaulting to fastbuild (same default as --compilation_mode, see 88# https://bazel.build/docs/user-manual#compilation-mode). 89build:for_mac_arm64 --config=for_mac_arm64_fastbuild 90build:for_mac_x64 --config=for_mac_x64_fastbuild 91 92# Some aliases using more common lingo. 93build:for_mac_m1 --config=for_mac_arm64 94build:for_mac_intel --config=for_mac_x64 95 96# Android configuration for 32-bit ARM (armeabi-v7a ABI). 97build:for_android_arm32_debug --platforms=//bazel/platform:android_arm32 \ 98 --compilation_mode=dbg \ 99 --cc_output_directory_tag=android_arm32_debug 100build:for_android_arm32_release --platforms=//bazel/platform:android_arm32 \ 101 --compilation_mode=opt \ 102 --cc_output_directory_tag=android_arm32_release 103build:for_android_arm32_fastbuild --platforms=//bazel/platform:android_arm32 \ 104 --compilation_mode=fastbuild \ 105 --cc_output_directory_tag=android_arm32_fastbuild 106 107build:for_android_arm32_debug_with_rbe --config=for_android_arm32_debug --config=linux_rbe 108build:for_android_arm32_release_with_rbe --config=for_android_arm32_release --config=linux_rbe 109build:for_android_arm32_fastbuild_with_rbe --config=for_android_arm32_fastbuild --config=linux_rbe 110 111# Shorter config names defaulting to fastbuild (same default as --compilation_mode, see 112# https://bazel.build/docs/user-manual#compilation-mode). 113build:for_android_arm32 --config=for_android_arm32_fastbuild 114build:for_android_arm32_with_rbe --config=for_android_arm32_fastbuild_with_rbe 115build:android_arm32_rbe --config=for_android_arm32_fastbuild_with_rbe 116 117# Android configuration for 64-bit ARM (arm64-v8a ABI). 118build:for_android_arm64_debug --platforms=//bazel/platform:android_arm64 \ 119 --compilation_mode=dbg \ 120 --cc_output_directory_tag=android_arm64_debug 121build:for_android_arm64_release --platforms=//bazel/platform:android_arm64 \ 122 --compilation_mode=opt \ 123 --cc_output_directory_tag=android_arm64_release 124build:for_android_arm64_fastbuild --platforms=//bazel/platform:android_arm64 \ 125 --compilation_mode=fastbuild \ 126 --cc_output_directory_tag=android_arm64_fastbuild 127 128build:for_android_arm64_debug_with_rbe --config=for_android_arm64_debug --config=linux_rbe 129build:for_android_arm64_release_with_rbe --config=for_android_arm64_release --config=linux_rbe 130build:for_android_arm64_fastbuild_with_rbe --config=for_android_arm64_fastbuild --config=linux_rbe 131 132# Shorter config names defaulting to fastbuild (same default as --compilation_mode, see 133# https://bazel.build/docs/user-manual#compilation-mode). 134build:for_android_arm64 --config=for_android_arm64_fastbuild 135build:for_android_arm64_with_rbe --config=for_android_arm64_fastbuild_with_rbe 136build:android_rbe --config=for_android_arm64_fastbuild_with_rbe 137 138#IOS configs 139build:for_ios --platforms=//bazel/platform:ios --compilation_mode=dbg --cc_output_directory_tag=ios_arm64_fastbuild 140 141# ============================================================================= 142# Configurations (what features we want on) 143# ============================================================================= 144# These are examples of the syntax to create build configurations. As of May 2022, our 145# Bazel configurations are still being made. 146build:release --compilation_mode=opt 147build:debug --compilation_mode=dbg 148 149# See also https://github.com/emscripten-core/emsdk/issues/984 for disabling cc_toolchain_resolution 150build:canvaskit_full --noincompatible_enable_cc_toolchain_resolution \ 151 --ck_enable_fonts --ck_enable_embedded_font \ 152 \ 153 --ck_enable_canvas_polyfill --ck_enable_skp_serialization --ck_enable_skottie \ 154 --ck_enable_runtime_effect --ck_enable_matrix_js 155 156build:ck_webgl2 --ck_enable_webgl 157 158build:ck_full_webgl2_release --config=canvaskit_full --config=ck_webgl2 --config=release 159build:ck_full_webgl2_debug --config=canvaskit_full --config=ck_webgl2 --config=debug 160build:ck_full_cpu_release --config=canvaskit_full --config=release 161build:ck_full_cpu_debug --config=canvaskit_full --config=debug 162build:ck_full_webgl2_release_debugger --config=canvaskit_full --config=ck_webgl2 \ 163 --config=release --ck_include_debugger 164# TODO(kjlubick) We should be able to configure testing on Chrome or Firefox with this. 165build:ck_full_webgl2_release_chrome --config=ck_full_webgl2_release 166build:ck_full_cpu_release_chrome --config=ck_full_cpu_release 167 168# config when building //infra/debugger-app:debugger_container. 169# This is invoked in a Louhi flow. 170build:debugger_app_container --config=ck_full_webgl2_release_debugger \ 171 --workspace_status_command=bazel/get_workspace_status.sh \ 172 --@io_bazel_rules_docker//transitions:enable=false 173 174# config when building //infra/jsfiddle:jsfiddle_container. 175# This is invoked in a Louhi flow. 176build:jsfiddle_container --config=ck_full_webgl2_release \ 177 --workspace_status_command=bazel/get_workspace_status.sh \ 178 --@io_bazel_rules_docker//transitions:enable=false 179 180# config when building //infra/shaders:shaders_container. 181# This is invoked in a Louhi flow. 182build:shaders_container --config=ck_full_webgl2_release \ 183 --workspace_status_command=bazel/get_workspace_status.sh \ 184 --@io_bazel_rules_docker//transitions:enable=false 185 186# config when building //infra/skottie:skottie_container. 187# This is invoked in a Louhi flow. 188build:skottie_container --config=ck_full_webgl2_release \ 189 --workspace_status_command=bazel/get_workspace_status.sh \ 190 --@io_bazel_rules_docker//transitions:enable=false 191 192# We only want to enforce IWYU on debug builds because we have some things that are only 193# necessary to include in debug mode (e.g. SkDEBUGCODE), but very rarely something that is 194# only needed in release mode. Thus our C++ debug includes should be a superset of the 195# release includes. 196build:enforce_iwyu --features=skia_enforce_iwyu --cc_output_directory_tag=iwyu \ 197 --compilation_mode=dbg --keep_going \ 198 --linkopt="SKIA_SKIP_LINKING" 199 200build:use_linux_rbe_pool --config=linux_rbe --remote_download_minimal 201 202build:cpu_only --cc_output_directory_tag=cpu_tests 203build:cpu_only_debug --config=cpu --config=debug 204build:cpu_only_release --config=cpu --config=release 205build:cpu_only_debug_rbe --config=cpu_only_debug --config=use_linux_rbe_pool 206build:cpu_only_release_rbe --config=cpu_only_release --config=use_linux_rbe_pool 207 208build:gl_ganesh --enable_gpu_test_utils --gpu_backend=gl_ganesh \ 209 --cc_output_directory_tag=gl_ganesh 210# We need to have this environment variable set when testing our Ganesh GL backend on Unix, 211# otherwise, we get "Failed to open X display." and connect make a GL context for testing. 212build:gl_ganesh --action_env=DISPLAY=:1 213 214build:vulkan_ganesh --enable_gpu_test_utils --gpu_backend=vulkan_ganesh \ 215 --cc_output_directory_tag=vulkan_ganesh 216 217build:metal_ganesh --enable_gpu_test_utils --gpu_backend=metal_ganesh\ 218 --cc_output_directory_tag=metal_ganesh 219 220# Short-hand aliases 221build:cpu --config=cpu_only 222build:gl --config=gl_ganesh 223build:vk --config=vulkan_ganesh 224 225# We would ideally like to remove the SKSL_STANDALONE define one day, 226# but it is needed by SkRasterPipelineBuilder when being compiled for GN 227build:compile_sksl --cc_output_directory_tag=compile_sksl \ 228 --compilation_mode=opt --//src/core:load_sksl_from_disk --copt="-DSKSL_STANDALONE=1" 229 230# Layering check does not work without sandboxing because the system headers are not in the 231# right spot and so they are not found. 232build:no_sandbox --spawn_strategy=local --features=-layering_check 233