-
Notifications
You must be signed in to change notification settings - Fork 19
/
.bazelrc
99 lines (86 loc) · 3.63 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
# Make Bazel pickup Linux/Windows configs automatically.
build --enable_platform_specific_config
# Linux-specific configuration.
build:linux --cxxopt=-std=c++17
build:linux --copt=-Wall
build:linux --copt=-Wextra
build:linux --copt=-Wpedantic
build:linux --copt=-Werror
build:linux --cxxopt=-fno-exceptions
build:linux --cxxopt=-fno-rtti
build:linux --copt=-Wno-gcc-compat
# Force clang on Linux (this is to support libFuzzer).
build:linux --action_env=CC=clang
build:linux --action_env=CXX=clang++
# Windows-specific configuration.
build:windows --cxxopt=/std:c++17
build:windows --copt=/W4
build:windows --copt=/WX
build:windows --copt=/utf-8 # Enable char32_t literals used in tests, e.g. U'x'
build:windows --cxxopt=/GR- # Disable RTTI
# Disable some warnings completely, since in MSVC 19.28.29333 "/external" option doesn't work:
https://developercommunity.visualstudio.com/content/problem/1252451/clexe-flag-externalw0-doesnt-work-in-msvc-19282933.html
# Full list of warnings that are disabled for LLVM on Windows:
https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/HandleLLVMOptions.cmake
build:windows --copt=/wd4100
build:windows --copt=/wd4146
build:windows --copt=/wd4244
build:windows --copt=/wd4245
build:windows --copt=/wd4251
build:windows --copt=/wd4267
build:windows --copt=/wd4324
build:windows --copt=/wd4389
build:windows --copt=/wd4456
build:windows --copt=/wd4458
build:windows --copt=/wd4624
# On Windows clang.exe tries to find the MSVC toolchain by looking at environmental variables,
# querying Visual Studio instances via COM (>=2017) and reading Registry keys (<=2015).
# VCToolsInstallDir allows to specify the exact toolchain to use and ProgramData data is typically
# required for COM querying, unless a custom location for Visual Studio package cache is defined.
build:windows --action_env=VCToolsInstallDir
build:windows --action_env=ProgramData
# AddressSanitizer (ASan).
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-DADDRESS_SANITIZER
build:asan --copt=-O0
build:asan --copt=-g
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
# MemorySanitizer (MSan).
build:msan --strip=never
build:msan --copt=-fsanitize=memory
build:msan --copt=-DMEMORY_SANITIZER
build:msan --copt=-O0
build:msan --copt=-fsanitize-memory-track-origins
build:msan --copt=-fsanitize-memory-use-after-dtor
build:msan --copt=-fno-omit-frame-pointer
build:msan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:msan --linkopt=-fsanitize=memory
build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1
# ThreadSanitizer (TSan).
build:tsan --strip=never
build:tsan --copt=-fsanitize=thread
build:tsan --copt=-DTHREAD_SANITIZER
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:tsan --linkopt=-fsanitize=thread
# UndefinedBehaviorSanitizer (UBSan).
build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-DUNDEFINED_BEHAVIOR_SANITIZER
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --copt=-DNDEBUG
build:ubsan --copt=-fno-sanitize=vptr
build:ubsan --linkopt=-fsanitize=undefined
# Config for running under Valgrind
build:valgrind --copt=-DCONFIG_VALGRIND
# Try loading per-user configuration.
try-import %workspace%/user.bazelrc
# Configuration for running libFuzzer locally.
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
# A target in rules_fuzzing doesn't use parameter.
build:libfuzzer --copt=-Wno-unused-parameter
build:asan-libfuzzer --config=libfuzzer
build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan