-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy path.bazelrc
More file actions
181 lines (137 loc) · 6.69 KB
/
.bazelrc
File metadata and controls
181 lines (137 loc) · 6.69 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
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
# Transparently attempt to use the tensorstore mirror for bazel downloads
common --downloader_config=bazel/rewrite.config
# Enable using platform specific build settings
build --enable_platform_specific_config
# Disable bzlmod to suppress a warning since we don't yet support it.
build --noenable_bzlmod --enable_workspace
# Specify platform mapping to ensure "platforms" and --cpu flags are
# in sync.
build --platform_mappings=tools/bazel_platforms/platform_mappings
# Use absl with googletest
build --define=absl=1
build --define=protobuf_allow_msvc=true
# ----------------------------------------
# Configure C++17 mode
# ----------------------------------------
build:gcc_or_clang --cxxopt=-std=c++17
build:gcc_or_clang --host_cxxopt=-std=c++17
build:gcc_or_clang --cxxopt=-fsized-deallocation
build:gcc_or_clang --host_cxxopt=-fsized-deallocation
build:msvc --cxxopt=/std:c++17
build:msvc --host_cxxopt=/std:c++17
# Use sized deallocation for C++ objects
build:msvc --cxxopt=/Zc:sizedDealloc
build:msvc --host_cxxopt=/Zc:sizedDealloc
# Make MSVC conform to the C++ standard regarding hidden friends
build:msvc --cxxopt=/Zc:hiddenFriend
build:msvc --host_cxxopt=/Zc:hiddenFriend
# ----------------------------------------
# protobuf/upb has some functions where errors are incorrectly raised:
# https://github.com/protocolbuffers/upb/blob/main/upb/message/accessors_internal.h
build:gcc_or_clang --per_file_copt=upb/.*\\.c$@-Wno-array-bounds,-Wno-stringop-overread
build:gcc_or_clang --host_per_file_copt=upb/.*\\.c$@-Wno-array-bounds,-Wno-stringop-overread
build:gcc_or_clang --per_file_copt=upbc/.*\\.cc$@-Wno-array-bounds,-Wno-stringop-overread
build:gcc_or_clang --host_per_file_copt=upbc/.*\\.cc$@-Wno-array-bounds,-Wno-stringop-overread
build:gcc_or_clang --per_file_copt=grpc/src/.*\\.cc$@-Wno-attributes
build:gcc_or_clang --host_per_file_copt=grpc/src/.*\\.cc$@-Wno-attributes
build:msvc --per_file_copt=upb/.*\\.c$@/wd5287
build:msvc --host_per_file_copt=upb/.*\\.c$@/wd5287
build:msvc --per_file_copt=.*\\.upb\\.c$@/wd5287
build:msvc --host_per_file_copt=.*\\.upb\\.c@/wd5287
build:msvc --per_file_copt=.*\\.upbdefs\\.c$@/wd5287
build:msvc --host_per_file_copt=.*\\.upbdefs\\.c$@/wd5287
build:msvc --per_file_copt=.*\\.upb_minitable\\.c$@/wd5287
build:msvc --host_per_file_copt=.*\\.upb_minitable\\.c@/wd5287
# gRPC has some errors on windows as well
build:msvc --per_file_copt=grpc/.*\\.cc$@/wd4624
build:msvc --host_per_file_copt=grpc/.*\\.cc$@/wd4624
build:msvc --per_file_copt=grpc/.*\\.cc$@/wd4244
build:msvc --host_per_file_copt=grpc/.*\\.cc$@/wd4244
build:msvc --per_file_copt=external/xds/.*\\.cc$@/wd4244
build:msvc --host_per_file_copt=external/xds/.*\\.cc$@/wd4244
# ----------------------------------------
# Disable warnings
# ----------------------------------------
# Use colors for diagnostics
build:gcc_or_clang --copt=-fdiagnostics-color=always
build:gcc_or_clang --host_copt=-fdiagnostics-color=always
# disable deprecated-declarations warnings
build:gcc_or_clang --copt='-Wno-deprecated-declarations'
build:gcc_or_clang --host_copt='-Wno-deprecated-declarations'
# disable mixed sign comparison warnings
build:gcc_or_clang --copt='-Wno-sign-compare'
build:gcc_or_clang --host_copt='-Wno-sign-compare'
# disable spurious warnings from gcc
build:gcc_or_clang --copt='-Wno-unused-but-set-parameter'
build:gcc_or_clang --host_copt='-Wno-unused-but-set-parameter'
build:gcc_or_clang --copt='-Wno-maybe-uninitialized'
build:gcc_or_clang --host_copt='-Wno-maybe-uninitialized'
# Not applicable in C++17 but still warned about.
build:gcc_or_clang --copt='-Wno-sequence-point'
build:gcc_or_clang --host_copt='-Wno-sequence-point'
# disable warnings from clang about unknown warnings
build:gcc_or_clang --copt='-Wno-unknown-warning-option'
build:gcc_or_clang --host_copt='-Wno-unknown-warning-option'
# disable warnings from clang about stringof-overflow
build:gcc_or_clang --copt='-Wno-stringop-overflow'
build:gcc_or_clang --host_copt='-Wno-stringop-overflow'
# Disable warning regarding `msvc::no_unique_address`
build:msvc --copt=/wd4848
build:msvc --host_copt=/wd4848
# ----------------------------------------
# Linux and FreeBSD configuration settings
# ----------------------------------------
# Assume GCC or Clang on Linux
build:linux --config=gcc_or_clang
build:freebsd --config=gcc_or_clang
# ------------------------------
# MacOS configuration settings
# ------------------------------
# We can safely assume Clang or GCC on macOS (almost surely Clang).
build:macos --config=gcc_or_clang
# Workaround for https://github.com/abseil/abseil-cpp/issues/848
# Root cause: https://github.com/bazelbuild/bazel/issues/4341
build:macos --features=-supports_dynamic_linker
# ------------------------------
# Windows configuration settings
# ------------------------------
# Significantly speeds up Python test execution. Requires Windows
# developer mode enabled in order for non-admin users to create
# symlinks.
startup --windows_enable_symlinks
# https://github.com/protocolbuffers/protobuf/issues/12947
# Windows has path-length limits of 260 characters leading to errors which
# may require a shorter filenames. If encountered, uncomment and adjust:
#
# startup --output_base=C:\\Out
# By default assume MSVC on Windows.
build:windows --config=msvc
build:windows --config=windows_common
# Fix https://github.com/bazelbuild/bazel/issues/17068
#
# In Bazel 6.0.0, `archive_param_file` was accidentally disabled by
# default for Windows.
build:windows_common --features=archive_param_file
build:windows_common --features=linker_param_file
build:windows_common --features=compiler_param_file
build:windows_common --enable_runfiles=true
build:windows_common --build_python_zip=false
# ------------------------------
# MINGW settings
# ------------------------------
# Unfortunately, with `--incompatible_enable_cc_toolchain_resolution`
# specified, it is inconvenient to use mingw.
#
# https://bazel.build/configure/windows#clang
build:windows_x86_64_mingw --noenable_platform_specific_config --config=windows_common --config=gcc_or_clang
build:windows_x86_64_mingw --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw
build:windows_x86_64_mingw --extra_execution_platforms=//tools/bazel_platforms:windows_x86_64_mingw
# Prevent "file too big" / "too many sections" errors.
build:windows_x86_64_mingw --copt='-Wa,-mbig-obj'
build:windows_x86_64_mingw --host_copt='-Wa,-mbig-obj'
# mingw https://sourceforge.net/p/mingw-w64/bugs/134/
build:windows_x86_64_mingw --copt=-D_NO_W32_PSEUDO_MODIFIERS
build:windows_x86_64_mingw --host_copt=-D_NO_W32_PSEUDO_MODIFIERS
# optimize chttp2 for "file too big" errors for grpc
build:windows_x86_64_mingw --per_file_copt=grpc/src/core/.*\\.cc$@-O2
build:windows_x86_64_mingw --host_per_file_copt=grpc/src/core/.*\\.cc$@-O2