-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bazelrc
133 lines (103 loc) · 4.78 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
##
## Donner build config
##
## Options:
##
## --config=latest_llvm - Build with LLVM toolchain (downloads automatically)
## --config=debug - Build debug with configs set to simplify debugging.
## --config=binary-size - Build optimized build and symbols for binary size analysis.
## --config=macos-binary-size - Same as above but with additional flags for macOS.
## --config=coverage - Build with code coverage instrumentation.
## --config=asan - Build with address sanitizer.
## --config=asan-fuzzer - Build with address sanitizer and fuzzing engine.
## --config=clang - Build with clang-tidy checks.
##
# Enables using platform-specific configs such as build:linux and build:macos in this .bazelrc file
build --enable_platform_specific_config
##
## Build config
##
# Disable layering check since toolchains_llvm has issues with it.
build --features=-layering_check
# Disable exceptions and rtti
build --copt=-fno-exceptions
build --copt=-fno-rtti
# Disable warning about a 'switch' missing 'default' label, which started triggering in skia on clang 19
build --copt=-Wno-switch-default
# Use registered clang toolchain.
build --incompatible_enable_cc_toolchain_resolution
# Enable building with the latest llvm toolchain (downloaded on-demand, see MODULE.bazel)
common:latest_llvm --extra_toolchains=@llvm_toolchain//:all
common:latest_llvm --//build_defs:llvm_latest=1
# Build with the latest llvm toolchain by default on Linux. Do not set on mac since it cannot be used to build objc
# and the imgui viewer requires it
build:linux --config=latest_llvm
# Clang with libc++
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:libc++ --action_env=LDFLAGS=-stdlib=libc++
build:libc++ --define force_libcpp=enabled
# C++20
build:c++20 --cxxopt=-std=c++20 --cxxopt=-fexperimental-library
# Host toolchain using libstdc++ instead of libc++, for libclang support
build:host_libstdc++ --host_cxxopt=-std=c++20 --host_cxxopt=-stdlib=libstdc++ --host_linkopt=-lstdc++
build:linux --config=host_libstdc++ --copt=-fno-modules
# Fixes symbols when debugging on mac.
build:macos --features=oso_prefix_is_pwd
# Reduces binary size on mac
build:macos-binary-size --config=binary-size
build:macos-binary-size --linkopt=-exported_symbols_list --linkopt=/dev/null
build:macos-binary-size --copt=-gline-tables-only
build:macos-binary-size --linkopt=-dead_strip
build --config=libc++ --config=c++20 --define absl=1
# Debug builds
build:debug -c dbg --copt=-O0 --copt=-g
# Creates symlinks in the workspace that point into the sandbox.
build:debug --symlink_prefix=/
# Binary size builds
build:binary-size -c opt --copt=-Os --copt=-g --strip=never
# For test coverage install the failure signal handler
test --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1"
# Coverage builds
coverage --config=coverage
coverage --combined_report=lcov
coverage --instrumentation_filter="//donner[:/]"
coverage:macos --test_env=COVERAGE_GCOV_PATH=/Library/Developer/CommandLineTools/usr/bin/llvm-profdata
coverage:macos --test_env=LLVM_COV=/Library/Developer/CommandLineTools/usr/bin/llvm-cov
build:coverage --cxxopt=-DNDEBUG
build:coverage --experimental_generate_llvm_lcov
build:coverage --copt=-ffile-compilation-dir=.
build:coverage --action_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1
build:coverage --action_env=GCOV=llvm-profdata
build:coverage --action_env=BAZEL_LLVM_COV=llvm-cov
test:coverage --collect_code_coverage
test:coverage --nocache_test_results
# Basic ASAN/UBSAN that works for gcc
build:asan --config=latest_llvm
build:asan --linkopt=-ldl
build:asan --copt=-fsanitize=address,undefined
build:asan --linkopt=-fsanitize=address,undefined
build:asan --copt=-fno-omit-frame-pointer
build:asan --copt=-fsanitize-address-use-after-scope
build:asan --test_env=ASAN_SYMBOLIZER_PATH
# These require libubsan, which is not linked properly by bazel, so disable.
# See https://github.com/google/oss-fuzz/issues/713
build:asan --copt=-fno-sanitize=vptr,function
build:asan --linkopt=-fno-sanitize=vptr,function
build:asan --strip=never
# Fuzzing builds
build:asan-fuzzer --config=asan
build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link
build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:asan-fuzzer --copt=-fno-omit-frame-pointer
build:asan-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1
# Required for bazel_clang_tidy to operate as expected
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
# Optionally override the .clang-tidy config file target
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
##
## Test config
##
# Outputs test failures from failing tests instead just linking to test.log.
test --test_output=errors