-
Notifications
You must be signed in to change notification settings - Fork 120
/
.bazelrc
132 lines (103 loc) · 5.15 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
# 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
# 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
# Configure C++17 mode
#
# Note: We can't use --cxxopt because of
# https://github.com/bazelbuild/bazel/issues/15550
build:gcc_or_clang --per_file_copt=.*\\.cc$,.*\\.cpp$@-std=c++17,-fsized-deallocation
build:gcc_or_clang --host_per_file_copt=.*\\.cc$,.*\\.cpp$@-std=c++17,-fsized-deallocation
build:msvc --per_file_copt=.*\\.cc$,.*\\.cpp$@/std:c++17
build:msvc --host_per_file_copt=.*\\.cc$,.*\\.cpp$@/std:c++17
# 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-overflow,-Wno-stringop-overread
build:gcc_or_clang --host_per_file_copt=upb/.*\\.c$@-Wno-array-bounds,-Wno-stringop-overflow,-Wno-stringop-overread
build:gcc_or_clang --per_file_copt=upbc/.*\\.cc$@-Wno-array-bounds,-Wno-stringop-overflow,-Wno-stringop-overread
build:gcc_or_clang --host_per_file_copt=upbc/.*\\.cc$@-Wno-array-bounds,-Wno-stringop-overflow,-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
# Use colors
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'
# ----------------------------------------
# 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
# Define mingw configuration.
#
# 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
build:windows_common --enable_runfiles=true --build_python_zip=false
# Disable warning regarding `msvc::no_unique_address`
build:msvc --copt=/wd4848
build:msvc --host_copt=/wd4848
# Make MSVC conform to the C++ standard regarding hidden friends
build:msvc --copt=/Zc:hiddenFriend
build:msvc --host_copt=/Zc:hiddenFriend