• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 --platforms=//bazel/platform:linux_x64_hermetic --cc_output_directory_tag=linux_x64
39build:for_linux_x64_with_rbe --config=for_linux_x64 --config=linux_rbe
40
41build:for_mac_arm64 --platforms=//bazel/platform:mac_arm64_hermetic --cc_output_directory_tag=mac_arm64
42build:for_mac_x64 --platforms=//bazel/platform:mac_x64_hermetic --cc_output_directory_tag=mac_x64
43# some aliases using more common lingo
44build:for_mac_m1 --config=for_mac_arm64
45build:for_mac_intel --config=for_mac_x64
46
47
48# =============================================================================
49# Configurations (what features we want on)
50# =============================================================================
51# These are examples of the syntax to create build configurations. As of May 2022, our
52# Bazel configurations are still being made.
53build:release --compilation_mode=opt
54build:debug --compilation_mode=dbg
55
56# See also https://github.com/emscripten-core/emsdk/issues/984 for disabling cc_toolchain_resolution
57build:canvaskit_full --noincompatible_enable_cc_toolchain_resolution \
58                     --include_decoder=gif_decode_codec --include_decoder=jpeg_decode_codec \
59                     --include_decoder=png_decode_codec --include_decoder=webp_decode_codec \
60                     \
61                     --include_encoder=jpeg_encode_codec --include_encoder=png_encode_codec \
62                     --include_encoder=webp_encode_codec \
63                     \
64                     --with_harfbuzz --with_icu --fontmgr_factory=custom_embedded_fontmgr_factory \
65                     --ck_enable_fonts --ck_enable_embedded_font \
66                     \
67                     --disable_tracing --enable_sksl_tracing \
68                     \
69                     --ck_enable_canvas_polyfill --ck_enable_skp_serialization --ck_enable_skottie \
70                     --ck_enable_runtime_effect --ck_enable_matrix_js
71
72build:ck_webgl2 --with_gl_standard=webgl_standard --gpu_backend=gl_backend \
73                --disable_legacy_shader_context
74# CPU build needs legacy shader context otherwise SkPerlinNoiseShader does not render
75build:ck_cpu --enable_sksl --enable_legacy_shader_context
76
77build:ck_full_webgl2_release --config=canvaskit_full --config=ck_webgl2 --config=release
78build:ck_full_webgl2_debug --config=canvaskit_full --config=ck_webgl2 --config=debug
79build:ck_full_cpu_release --config=canvaskit_full --config=ck_cpu --config=release
80build:ck_full_cpu_debug --config=canvaskit_full --config=ck_cpu --config=debug
81# TODO(kjlubick) We should be able to configure testing on Chrome or Firefox with this.
82build:ck_full_webgl2_release_chrome --config=ck_full_webgl2_release
83build:ck_full_cpu_release_chrome --config=ck_full_cpu_release
84
85# We only want to enforce IWYU on debug builds because we have some things that are only
86# necessary to include in debug mode (e.g. SkDEBUGCODE), but very rarely something that is
87# only needed in release mode. Thus our C++ debug includes should be a superset of the
88# release includes.
89build:enforce_iwyu --features=skia_enforce_iwyu --cc_output_directory_tag=iwyu \
90                   --compilation_mode=dbg --keep_going \
91                   --with_gl_standard=gl_standard --gpu_backend=gl_backend \
92                   --gpu_backend=vulkan_backend --gpu_backend=dawn_backend \
93                   --enable_gpu_test_utils --force_cpu_tests \
94                   --include_fontmgr=custom_directory_fontmgr --include_fontmgr=custom_embedded_fontmgr \
95                   --include_fontmgr=custom_empty_fontmgr --fontmgr_factory=custom_directory_fontmgr_factory \
96                   --include_decoder=avif_decode_codec --include_decoder=gif_decode_codec \
97                   --include_decoder=jpeg_decode_codec --include_decoder=jxl_decode_codec \
98                   --include_decoder=png_decode_codec --include_decoder=raw_decode_codec \
99                   --include_decoder=webp_decode_codec \
100                   --include_encoder=jpeg_encode_codec --include_encoder=png_encode_codec \
101                   --include_encoder=webp_encode_codec \
102                   --with_harfbuzz --with_icu \
103                   --enable_sksl_tracing \
104                   --enable_svg_canvas --enable_pdf_backend \
105                   --compile_generated_cpp_files_for_headers
106
107
108build:use_linux_rbe_pool --config=linux_rbe --remote_download_minimal
109
110build:cpu_only --cc_output_directory_tag=cpu_tests
111build:cpu_only_debug --config=cpu --config=debug
112build:cpu_only_release --config=cpu --config=release
113build:cpu_only_debug_rbe --config=cpu_only_debug --config=use_linux_rbe_pool
114build:cpu_only_release_rbe --config=cpu_only_release --config=use_linux_rbe_pool
115
116build:gl_ganesh --enable_gpu_test_utils --gpu_backend=gl_backend \
117                 --cc_output_directory_tag=gl_ganesh
118# We need to have this environment variable set when testing our Ganesh GL backend on Unix,
119# otherwise, we get "Failed to open X display." and connect make a GL context for testing.
120build:gl_ganesh --action_env=DISPLAY=:1
121
122build:vulkan_ganesh --enable_gpu_test_utils --gpu_backend=vulkan_backend \
123                    --cc_output_directory_tag=vulkan_ganesh
124
125build:dawn_ganesh --enable_gpu_test_utils --gpu_backend=dawn_backend \
126                    --cc_output_directory_tag=dawn_ganesh
127
128# Short-hand aliases
129build:cpu --config=cpu_only
130build:gl --config=gl_ganesh
131build:vk --config=vulkan_ganesh
132build:dawn --config=dawn_ganesh
133
134# Layering check does not work without sandboxing because the system headers are not in the
135# right spot and so they are not found.
136build:no_sandbox --spawn_strategy=local --features=-layering_check