-
Notifications
You must be signed in to change notification settings - Fork 2
/
.bazelrc
163 lines (136 loc) · 6.44 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
#
# SPDX-FileCopyrightText: Copyright 2022-2024 Julian Amann <dev@vertexwahn.de>
# SPDX-License-Identifier: Apache-2.0
#
# Supported OS identifiers are linux, macos, windows, freebsd, and openbsd.
# Ignored for now - details here: https://stackoverflow.com/questions/73873449/can-enable-platform-specific-config-be-ignored-or-overriden
# build --enable_platform_specific_config
#build --symlink_prefix=/ # Suppress symlink creation (to avoid untracked files issues with git)
#-------------------------------------------------------------------------------------
# Bzlmod
#-------------------------------------------------------------------------------------
#common --registry=file:///%workspace%/registry # Does not work on Windows 11 + Bazel 6.5.0
#common --registry=https://vertexwahn.de/registry
common --registry=https://raw.githubusercontent.com/Vertexwahn/bazel-registry/main/ # Needed for Boost
common --registry=https://bcr.bazel.build
#-------------------------------------------------------------------------------------
# C++ compiler settings
#-------------------------------------------------------------------------------------
# macOS (e.g. Clang 14.0.0)
build:macos --cxxopt=-std=c++2b # see https://clang.llvm.org/cxx_status.html
build:macos --cxxopt=-Wall # Turn on all warnings
build:macos --define compiler=macos
build:macos --noincompatible_enable_cc_toolchain_resolution # disable LLVM toolchain
#build:macos --cxxopt=-Werror # Commented out because of Embree
#build:macos --cxxopt=-Wextra
#build:macos --spawn_strategy=local
# Xcode 15 has some compiler issues - therefore there is this special config
build:macos_xcode15 --config=macos
build:macos_xcode15 --linkopt=-ld_classic # Workaround for Xcode 15 linker bug, see for instance https://github.com/godotengine/godot/pull/81968/files
# macOS Intel (config used in CI jobs)
build:clang14_macos --cxxopt=-std=c++20
build:clang14_macos --noincompatible_enable_cc_toolchain_resolution # disable LLVM toolchain
build:clang14_macos --cxxopt=-mwaitpkg
build:clang14_macos --define compiler=clang14_macos
# not used anymore? Todo: Remove this config if it is not needed anymore
## macOS M1 (config is used on local MacBook M1 Pro)
#build:clang14_macos_m1 --cxxopt=-std=c++20
#build:clang14_macos_m1 --incompatible_enable_cc_toolchain_resolution
#build:clang14_macos_m1 --linkopt=-ld_classic # Workaround for Xcode 15 linker bug, see for instance https://github.com/godotengine/godot/pull/81968/files
##build:clang14_macos_m1 --cxxopt=-mwaitpkg # lead to compilation issues on local M1 macBook
#build:clang14_macos_m1 --define compiler=clang14_macos_m1
# Todo: Add apple_debug config
# https://github.com/RobotLocomotion/drake/search?q=apple_debug
# GCC 9.3
build:gcc9 --cxxopt=-std=c++2a
build:gcc9 --cxxopt=-Wall
build:gcc9 --define compiler=gcc9
build:gcc9 --noincompatible_enable_cc_toolchain_resolution # disable LLVM toolchain
#build:gcc9 --cxxopt=-Werror # blocked by googletest
##build:gcc9 --cxxopt=-Wextra
build:remote_gcc9 --cxxopt=-Wall
build:remote_gcc9 --cxxopt=-Werror
build:remote_gcc9 --define compiler=remote_gcc9
##build:remote_gcc9 --cxxopt=-Wextra
# GCC 11.4
#build:gcc11 --cxxopt=-std=c++23 # blocked by emsdk
build:gcc11 --cxxopt=-std=c++20
build:gcc11 --cxxopt=-Wall
build:gcc11 --define compiler=gcc11
build:gcc11 --cxxopt=-fpermissive # Needed for fmt
build:gcc11 --noincompatible_enable_cc_toolchain_resolution # disable LLVM toolchain
#build:gcc11 --cxxopt=-Werror
#build:gcc11 --cxxopt=-Wno-volatile # blocked by emsdk
##build:gcc11 --cxxopt=-Wextra
build:linux --config=gcc11
build:gcc11_cpp14 --cxxopt=-std=c++14
build:gcc11_cpp14 --cxxopt=-Wall
build:gc11_cpp14 --define compiler=gcc11_cpp14
# Clang 14.0.0 (config is used on Ubuntu)
build:clang14 --cxxopt=-std=c++20
#build:clang14 --cxxopt=-mavx
#build:clang14 --cxxopt=-mavx2
#build:clang14 --cxxopt=-msse4.2
#build:clang14 --cxxopt=-Werror
build:clang14 --incompatible_enable_cc_toolchain_resolution
# Tell Bazel to pass the right flags for llvm-ar, not libtool. Only needed if you are building on darwin.
# See https://github.com/bazelbuild/bazel/blob/5c75d0acec21459bbb13520817e3806e1507e907/tools/cpp/unix_cc_toolchain_config.bzl#L1000-L1024
build:clang14 --features=-libtool
build:clang14 --cxxopt=-mwaitpkg
build:clang14 --define compiler=clang14
# Clang 16.0.0 (config is used on Ubuntu)
build:clang16 --cxxopt=-std=c++20
#build:clang16 --cxxopt=-mavx
#build:clang16 --cxxopt=-mavx2
#build:clang16 --cxxopt=-msse4.2
#build:clang16 --cxxopt=-Werror
build:clang16 --incompatible_enable_cc_toolchain_resolution
# Tell Bazel to pass the right flags for llvm-ar, not libtool. Only needed if you are building on darwin.
# See https://github.com/bazelbuild/bazel/blob/5c75d0acec21459bbb13520817e3806e1507e907/tools/cpp/unix_cc_toolchain_config.bzl#L1000-L1024
build:clang16 --features=-libtool
build:clang16 --cxxopt=-mwaitpkg
build:clang16 --define compiler=clang14
# MinGW
build:mingw --cxxopt=-std=c++2a
#build:mingw --cxxopt=-Wall
#build:mingw --cxxopt=-Werror
#build:mingw --cxxopt=-Wextra
# Visual Studio 2019
#build:vs2019 --copt=-DNOGDI
#build:vs2019 --host_copt=-DNOGDI
build:vs2019 --copt=-DWIN32_LEAN_AND_MEAN
build:vs2019 --cxxopt=/utf-8
build:vs2019 --cxxopt=/std:c++20
build:vs2019 --cxxopt=/Zc:__cplusplus
build:vs2019 --define compiler=vs2019
build:vs2019 --enable_runfiles # https://github.com/bazelbuild/bazel/issues/8843
build:vs2019 --host_copt=-DWIN32_LEAN_AND_MEAN
# Visual Studio 2022
#build:vs2022 --copt=-DNOGDI
#build:vs2022 --host_copt=-DNOGDI
build:vs2022 --copt=-DWIN32_LEAN_AND_MEAN
build:vs2022 --cxxopt=/std:c++20
build:vs2022 --cxxopt=/utf-8
build:vs2022 --cxxopt=/Zc:__cplusplus
build:vs2022 --define compiler=vs2022
build:vs2022 --enable_runfiles # https://github.com/bazelbuild/bazel/issues/8843
build:vs2022 --host_copt=-DWIN32_LEAN_AND_MEAN
build:windows --config=vs2022
# Address Sanitizer
build:asan --config=gcc9
build:asan --strip=never
build:asan --copt -fsanitize=address
build:asan --copt -O1
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
# clang-tidy
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_config2
build:clang-tidy --cxxopt=-std=c++17
# Optimized build
build:optimized build --copt=-O3
# IWYU
build:iwyu --aspects @com_github_storypku_bazel_iwyu//bazel/iwyu:iwyu.bzl%iwyu_aspect
build:iwyu --output_groups=report
try-import %workspace%/.bazelrc.remote_cache