-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy path.bazelrc
More file actions
145 lines (129 loc) · 5.11 KB
/
Copy path.bazelrc
File metadata and controls
145 lines (129 loc) · 5.11 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
# =============================================================================
# Common Settings
# =============================================================================
# TODO: Figure out how to use platform specific config
# common --enable_platform_specific_config
# TODO: Add flag for checking empty globs.
# This makes sure bazel doesn't implicitly create missing __init__.py files.
build --incompatible_default_to_explicit_init_py
build --experimental_isolated_extension_usages
# =============================================================================
# Build Performance
# =============================================================================
build --jobs=auto
build --remote_cache_compression
build --remote_cache_async
build --guard_against_concurrent_changes
build --experimental_reuse_sandbox_directories
# =============================================================================
# Developer Experience
# =============================================================================
build --show_progress_rate_limit=0.5
build --color=yes
build --terminal_columns=120
build --show_timestamps
build --announce_rc # Show which config files are read
build --heap_dump_on_oom # Dump heap on out-of-memory
test --test_output=all # Show all test output in real time
# =============================================================================
# C++ Compiler Settings
# =============================================================================
# Base C++ options
build --cxxopt=-std=c++20
build --host_cxxopt=-std=c++20
# LLVM/Clang toolchain
build --incompatible_enable_cc_toolchain_resolution
build:darwin --extra_toolchains=@llvm_toolchain//:cc-toolchain-aarch64-darwin
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
# =============================================================================
# Default Optimization Settings (Release Mode)
# =============================================================================
build --compilation_mode=opt
build --copt=-O3
build --copt=-march=native
build --copt=-DNDEBUG
# TODO This causes a linker error on linux
# build --copt=-flto
build --linkopt=-flto
build --strip=always
build --copt=-ffast-math
build --copt=-mtune=native
# =============================================================================
# Build Configurations
# =============================================================================
# Debug Configuration
build:debug --compilation_mode=dbg
build:debug --copt=-g3
build:debug --strip=never
build:debug --copt=-fno-omit-frame-pointer
build:debug --copt=-DDEBUG
build:debug --sandbox_debug
build:debug --verbose_failures
# Disable optimizations in debug mode
build:debug --copt=-O0
build:debug --copt=-fno-fast-math
build:debug --copt=-fno-lto
build:debug --linkopt=-fno-lto
# Development Configuration (Debug with extras)
build:dev --config=debug
build:dev --compilation_mode=dbg
build:dev --strip=never
# Release Configuration (explicit)
build:release --compilation_mode=opt
build:release --copt=-O3
build:release --copt=-DNDEBUG
build:release --strip=always
# =============================================================================
# Sanitizer Configurations
# =============================================================================
# Address Sanitizer
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-DADDRESS_SANITIZER
build:asan --copt=-O1
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt=-fsanitize=address
# Thread Sanitizer
build:tsan --strip=never
build:tsan --copt=-fsanitize=thread
build:tsan --copt=-DTHREAD_SANITIZER
build:tsan --copt=-O1
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --linkopt=-fsanitize=thread
# Memory Sanitizer
build:msan --strip=never
build:msan --copt=-fsanitize=memory
build:msan --copt=-DMEMORY_SANITIZER
build:msan --copt=-O1
build:msan --copt=-fno-omit-frame-pointer
build:msan --linkopt=-fsanitize=memory
# Undefined Behavior Sanitizer
build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-DUNDEFINED_BEHAVIOR_SANITIZER
build:ubsan --copt=-O1
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --linkopt=-fsanitize=undefined
# =============================================================================
# Platform Specific Settings
# =============================================================================
# Darwin (macOS) Settings
build:darwin --cxxopt=-mmacosx-version-min=15.2
build:darwin --linkopt=-mmacosx-version-min=15.2
build:darwin --action_env=CC=clang
build:darwin --action_env=CXX=clang++
# Linux Settings
build:linux --action_env=CC=clang
build:linux --action_env=CXX=clang++
build:linux --action_env=LD=clang
build:linux --action_env=LDXX=clang++
build:linux --cxxopt=-D_LINUX
build:linux --copt=-fPIC
# CUDA Settings (A6000, A100, H100)
build:linux --@rules_cuda//cuda:archs=compute_80,sm_80,compute_86,sm_86,compute_90,sm_90
# Windows Settings
build:windows --cxxopt=/D_WINDOWS
# =============================================================================
# Import Local Settings
# =============================================================================
try-import %workspace%/.bazelrc.local