-
Notifications
You must be signed in to change notification settings - Fork 868
Expand file tree
/
Copy path.bazelrc
More file actions
130 lines (104 loc) · 5.33 KB
/
.bazelrc
File metadata and controls
130 lines (104 loc) · 5.33 KB
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
common --enable_bzlmod
build --workspace_status_command=tools/workspace_status.sh
# Release builds embed real git version info; dev builds use cache-safe placeholders.
# Usage: bazel build --config=release //...
build:release --stamp
# suppress distracting warning about newer module
# versions found in dependency graph.
common --check_direct_dependencies=off
# Test timeouts for various levels.
test --test_timeout=300,1800,1800,9600
# bazel 7 is somewhat forgiving for glob patterns that don't
# match, but bazel 8 will be strict. So start now.
common --incompatible_disallow_empty_glob
common --experimental_isolated_extension_usages
build --cxxopt "-std=c++20" --host_cxxopt "-std=c++20"
build --cxxopt "-xc++" --host_cxxopt "-xc++"
build --cxxopt "-DBAZEL_BUILD" --host_cxxopt "-DBAZEL_BUILD"
# Default to optimized build (-c opt)
build -c opt
# Settings for --config=opt build: Enable -O3 and Full-LTO for performance
build:opt --copt=-O3
build:opt --copt=-flto
build:opt --linkopt=-flto
# Needed for floating point stability in FFT (fft_test will check this).
# See also https://kristerw.github.io/2021/11/09/fp-contract/
build --cxxopt "-ffp-contract=off" --host_cxxopt "-ffp-contract=off"
# allow exceptions.
build --cxxopt=-fexceptions --host_cxxopt=-fexceptions
# Turn warnings on...
build --copt "-Wall" --host_copt "-Wall"
build --copt "-Wextra" --host_copt "-Wextra"
# ... and disable the warnings we're not interested in.
build --copt "-Wno-sign-compare" --host_copt "-Wno-sign-compare"
build --copt "-Wno-unused-parameter" --host_copt "-Wno-unused-parameter"
build --copt "-Wno-gcc-compat" --host_copt "-Wno-gcc-compat"
build --copt "-Wno-nullability-extension" --host_copt "-Wno-nullability-extension"
build --copt "-Wno-deprecated-declarations" --host_copt "-Wno-deprecated-declarations"
build --copt "-Wno-unused-local-typedef" --host_copt "-Wno-unused-local-typedef"
build --cxxopt "-Wno-c++20-designator" --host_cxxopt "-Wno-c++20-designator"
# The warning acceptance bar in CI for PRs is set by -Werror of a specific
# version of some chosen compiler. Disable warnings from other compilers until
# they are fixed and under CI -Werror acceptance critera as there is nothing the
# developers can(they can't be reproduced locally or in CI) or should do about
# these warnings in code they are not working on.
build --copt "-Wno-cast-function-type-mismatch" --host_copt "-Wno-cast-function-type-mismatch"
build --copt "-Wno-unused-but-set-variable" --host_copt "-Wno-unused-but-set-variable"
build --cxxopt "-Wno-deprecated-copy" --host_cxxopt "-Wno-deprecated-copy"
build --cxxopt "-Wno-deprecated-copy-with-user-provided-copy" --host_cxxopt "-Wno-deprecated-copy-with-user-provided-copy"
build --cxxopt "-Wno-dangling" --host_cxxopt "-Wno-dangling"
# For 3rd party code: Disable warnings entirely.
# They are not actionable and just create noise.
build --per_file_copt=.*external/.*@-w
build --host_per_file_copt=.*external/.*@-w
# This avoid problems with building -c dbg which enables asserts.
# Without this libstdc++ vs libc++ differences cause link errors.
build --per_file_copt=.*external/abc.*@-stdlib=libc++
build --host_per_file_copt=.*external/abc.*@-stdlib=libc++
##### Platform-specific configs (auto-selected) #############
# --enable_platform_specific_config makes bazel automatically apply
# build:macos on macOS, build:linux on Linux, etc.
common --enable_platform_specific_config
# macOS: boost.stacktrace needs this since backtrace() doesn't require GNU source
build:macos --copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
build:macos --host_copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
# Aligned allocation/deallocation for abseil is only available since 10.13
build:macos --macos_minimum_os=10.13
build:macos --host_macos_minimum_os=10.13
# Settings for --config=asan address sanitizer build
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-DADDRESS_SANITIZER
build:asan --copt=-O1
build:asan --copt=-g
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt=-fsanitize=address
# Flags with enough debug symbols to get useful outputs with Linux `perf`
build:profile --strip=never
build:profile --copt -g --host_copt -g
build:profile --copt -gmlt --host_copt -gmlt
build:profile --copt -fno-omit-frame-pointer --host_copt -fno-omit-frame-pointer
# Improve hermeticity by disallowing user envars and network access
build --incompatible_strict_action_env
build --nosandbox_default_allow_network
test --build_tests_only
# --- Performance Optimizations ---
# Use a high number of jobs and let the scheduler manage concurrency
build --jobs=200
# Enable local disk caching to supplement the remote cache.
build --disk_cache=~/.cache/bazel-disk-cache
build --repository_cache=~/.cache/bazel-repository-cache
# CI only needs to know if the build succeeded, not the artifacts themselves.
build:ci --remote_download_minimal
build:ci --remote_upload_local_results=true
# Disable disk cache for CI builds
build:ci --disk_cache=
# Tell the 'ci' config to include 'opt'
build:ci --config=opt
# Setup remote cache
build --remote_cache=https://bazel.precisioninno.com
build --remote_cache_compression=true
build --remote_upload_local_results=false
# Without this, bazelisk build ... builds the bazel-orfs tests
build --build_tag_filters=-orfs
try-import %workspace%/user.bazelrc