-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.bazelrc
189 lines (153 loc) · 8.27 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Bazel configuration
# =========================================================
# https://github.com/bazelbuild/bazel/issues/18958
common --noenable_bzlmod
build --enable_platform_specific_config
coverage --combined_report=lcov
coverage --instrumentation_filter=-'_fuzz_test'
test --test_output=errors
test --test_summary=terse
test --test_verbose_timeout_warnings
# Bazel deprecations
# =========================================================
# See: https://docs.bazel.build/versions/main/backward-compatibility.html
# https://github.com/bazelbuild/bazel/issues/12821
common --nolegacy_external_runfiles
build --incompatible_config_setting_private_default_visibility
build --incompatible_disallow_empty_glob
build --incompatible_enforce_config_setting_visibility
# Third-party configuration
# =========================================================
# Don't require a system Python installation.
build --@rules_python//python/config_settings:bootstrap_impl=script
# Compiler configuration
# =========================================================
# Bazel + Clang supports this really cool features where it checks that you're
# not relying on transitive dependencies, so let's enable that!
build:linux --features=layering_check
build:linux --cxxopt='-std=c++2b'
build:linux --host_cxxopt='-std=c++2b'
build:linux --cxxopt='-fno-rtti'
build:linux --host_cxxopt='-fno-rtti'
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --features=layering_check
build:macos --cxxopt='-std=c++2b'
build:macos --host_cxxopt='-std=c++2b'
build:macos --cxxopt='-fno-rtti'
build:macos --host_cxxopt='-fno-rtti'
build:macos --objccopt='-ObjC++'
build:macos --objccopt='-std=c++2b'
build:windows --enable_runfiles
build:windows --action_env=LOCALAPPDATA # Quirk for running vswhere, remove when icu no-longer needed
build:windows --action_env=ProgramData # Quirk for running vswhere, remove when icu no-longer needed
build:windows --cxxopt='/std:c++latest'
build:windows --host_cxxopt='/std:c++latest'
build:windows --cxxopt='/GR-' # Disable rtti.
build:windows --host_cxxopt='/GR-'
build:windows --copt='/permissive-' # Conform to the standard.
build:windows --host_copt='/permissive-'
build:windows --copt='/Zc:__cplusplus' # Report the real supported C++ version, not just C++98.
build:windows --host_copt='/Zc:__cplusplus'
build:windows --copt='-utf-8' # Use UTF-8 as the source and execution character sets.
build:windows --host_copt='-utf-8'
# Special build options
# =========================================================
# https://bazel.build/configure/windows#clang
build:clang-cl --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
build:clang-cl --platforms=//:x64_windows-clang-cl
build:libc++ --cxxopt=-stdlib=libc++
build:libc++ --host_cxxopt=-stdlib=libc++
build:libc++ --cxxopt=-fexperimental-library
build:libc++ --host_cxxopt=-fexperimental-library
build:libc++ --linkopt=-stdlib=libc++
build:libc++ --host_linkopt=-stdlib=libc++
# https://releases.llvm.org/16.0.0/projects/libcxx/docs/ReleaseNotes.html#upcoming-deprecations-and-removals
build:libc++ --copt=-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES
build:libc++ --host_copt=-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES
# Some of this is from "Can I run AddressSanitizer with more aggressive diagnostics enabled?"
# on https://github.com/google/sanitizers/wiki/AddressSanitizer#faq and some is from
# https://chromium.googlesource.com/external/github.com/grpc/grpc/+/4e9206f48c91e17f43856b016b12f59dd5118293/tools/bazel.rc
build:asan --strip=never
build:asan --features=asan
build:asan --copt=-fsanitize-address-use-after-scope
build:asan --copt=-fno-omit-frame-pointer
build:asan --action_env=ASAN_OPTIONS=detect_odr_violation=2:detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
build:asan --action_env=LSAN_OPTIONS=report_objects=1
build:tsan --strip=never
build:tsan --features=tsan
build:tsan --action_env=TSAN_OPTIONS=halt_on_error=1
build:ubsan --strip=never
build:ubsan --features=ubsan
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --linkopt=-fsanitize-link-c++-runtime
build:ubsan --host_linkopt=-fsanitize-link-c++-runtime
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
build:clang-coverage
build:clang-coverage --action_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1
build:clang-coverage --experimental_generate_llvm_lcov
build:clang18-coverage --config=clang-coverage
build:clang18-coverage --action_env=BAZEL_LLVM_COV=llvm-cov-18
build:clang18-coverage --action_env=GCOV=llvm-profdata-18
build:clang19-coverage --config=clang-coverage
build:clang19-coverage --action_env=BAZEL_LLVM_COV=llvm-cov-19
build:clang19-coverage --action_env=GCOV=llvm-profdata-19
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
# Cross-compilation
# =========================================================
# See: https://github.com/uber/hermetic_cc_toolchain/issues/134
build:zig-cross --sandbox_add_mount_pair=/tmp
# build:zig-cross --sandbox_add_mount_pair=/var/tmp # macOS
# build:zig-cross --sandbox_add_mount_pair=C:\Temp # Windows
build:zig-cross --dynamic_mode=off
# TODO(robinlinden): Make this transitive so we can tag the no-cross targets
# instead of everything depending on no-cross targets.
# * icu's pkgdata stuff doesn't work w/ cross-compilation.
# * sfml links against host libraries: GL, X11.
# * py_test targets have host dependencies.
build:zig-cross --build_tag_filters=-no-cross
build:zig-cross --test_tag_filters=-no-cross
build:zig-cross-musl --config=zig-cross
build:zig-cross-musl --copt=-fPIC
# TODO(robinlinden): asio assumes __GLIBC__ is defined.
build:zig-cross-musl --copt=-Wno-error=undef
build:linux-amd64-musl --config=zig-cross-musl
build:linux-amd64-musl --platforms=@zig_sdk//platform:linux_amd64
build:linux-amd64-musl --extra_toolchains=@zig_sdk//toolchain:linux_amd64_musl
build:linux-aarch64-musl --config=zig-cross-musl
build:linux-aarch64-musl --platforms=@zig_sdk//platform:linux_arm64
build:linux-aarch64-musl --extra_toolchains=@zig_sdk//toolchain:linux_arm64_musl
build:macos-amd64 --config=zig-cross
build:macos-amd64 --platforms=@zig_sdk//platform:darwin_amd64
build:macos-amd64 --extra_toolchains=@zig_sdk//toolchain:darwin_amd64
build:macos-aarch64 --config=zig-cross
build:macos-aarch64 --platforms=@zig_sdk//platform:darwin_aarch64
build:macos-aarch64 --extra_toolchains=@zig_sdk//toolchain:darwin_arm64
build:windows-amd64 --config=zig-cross
build:windows-amd64 --platforms=@zig_sdk//platform:windows_amd64
build:windows-amd64 --extra_toolchains=@zig_sdk//toolchain:windows_amd64
build:wasi-wasm --config=zig-cross
build:wasi-wasm --platforms=@zig_sdk//platform:wasip1_wasm
build:wasi-wasm --extra_toolchains=@zig_sdk//toolchain:wasip1_wasm
# wasi doesn't support exceptions yet:
# https://github.com/WebAssembly/wasi-sdk/tree/f1ebc52a74394cdf885d03bfde13899b3d5c6d2d?tab=readme-ov-file#notable-limitations
build:wasi-wasm --copt=-fno-exceptions
# Fuzzing options
# =========================================================
# https://github.com/bazelbuild/rules_fuzzing says to also set
# @rules_fuzzing//fuzzing:cc_engine_sanitizer=asan or similar which sets things
# like -fsanitize=asan. We don't use this as we set these options ourselves.
# See:
# * https://github.com/bazelbuild/rules_fuzzing/blob/9865504b549e86ccfb4713afcc1914c982567f05/fuzzing/BUILD
# * https://github.com/bazelbuild/rules_fuzzing/blob/9865504b549e86ccfb4713afcc1914c982567f05/fuzzing/private/instrum_opts.bzl
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
build:honggfuzz --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:honggfuzz
build:honggfuzz --@rules_fuzzing//fuzzing:cc_engine_instrumentation=honggfuzz
# Misc configuration
# =========================================================
try-import %workspace%/.bazelrc.local