|
| 1 | +# ============================================================================= |
| 2 | +# Common Settings |
| 3 | +# ============================================================================= |
| 4 | +# TODO: Figure out how to use platform specific config |
| 5 | +# common --enable_platform_specific_config |
| 6 | +# TODO: Add flag for checking empty globs. |
| 7 | +# This makes sure bazel doesn't implicitly create missing __init__.py files. |
| 8 | +build --incompatible_default_to_explicit_init_py |
| 9 | +build --experimental_isolated_extension_usages |
| 10 | + |
| 11 | +# ============================================================================= |
| 12 | +# Build Performance |
| 13 | +# ============================================================================= |
| 14 | +build --jobs=auto |
| 15 | +build --experimental_remote_merkle_tree_cache |
| 16 | +build --experimental_remote_cache_compression |
| 17 | +build --experimental_remote_cache_async |
| 18 | +build --experimental_guard_against_concurrent_changes |
| 19 | +build --experimental_reuse_sandbox_directories |
| 20 | + |
| 21 | +# ============================================================================= |
| 22 | +# Developer Experience |
| 23 | +# ============================================================================= |
| 24 | +build --show_progress_rate_limit=0.5 |
| 25 | +build --color=yes |
| 26 | +build --terminal_columns=120 |
| 27 | +build --show_timestamps |
| 28 | +build --announce_rc # Show which config files are read |
| 29 | +build --heap_dump_on_oom # Dump heap on out-of-memory |
| 30 | +test --test_output=all # Show all test output in real time |
| 31 | + |
| 32 | +# ============================================================================= |
| 33 | +# C++ Compiler Settings |
| 34 | +# ============================================================================= |
| 35 | +# Base C++ options |
| 36 | +build --cxxopt=-std=c++20 |
| 37 | +build --host_cxxopt=-std=c++20 |
| 38 | + |
| 39 | +# LLVM/Clang toolchain |
| 40 | +build --incompatible_enable_cc_toolchain_resolution |
| 41 | +build:darwin --extra_toolchains=@llvm_toolchain//:cc-toolchain-aarch64-darwin |
| 42 | +build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux |
| 43 | + |
| 44 | +# ============================================================================= |
| 45 | +# Default Optimization Settings (Release Mode) |
| 46 | +# ============================================================================= |
| 47 | +build --compilation_mode=opt |
| 48 | +build --copt=-O3 |
| 49 | +build --copt=-march=native |
| 50 | +build --copt=-DNDEBUG |
| 51 | +# TODO This causes a linker error on linux |
| 52 | +# build --copt=-flto |
| 53 | +build --linkopt=-flto |
| 54 | +build --strip=always |
| 55 | +build --copt=-ffast-math |
| 56 | +build --copt=-mtune=native |
| 57 | + |
| 58 | +# ============================================================================= |
| 59 | +# Build Configurations |
| 60 | +# ============================================================================= |
| 61 | +# Debug Configuration |
| 62 | +build:debug --compilation_mode=dbg |
| 63 | +build:debug --copt=-g3 |
| 64 | +build:debug --strip=never |
| 65 | +build:debug --copt=-fno-omit-frame-pointer |
| 66 | +build:debug --copt=-DDEBUG |
| 67 | +build:debug --sandbox_debug |
| 68 | +build:debug --verbose_failures |
| 69 | +# Disable optimizations in debug mode |
| 70 | +build:debug --copt=-O0 |
| 71 | +build:debug --copt=-fno-fast-math |
| 72 | +build:debug --copt=-fno-lto |
| 73 | +build:debug --linkopt=-fno-lto |
| 74 | + |
| 75 | +# Development Configuration (Debug with extras) |
| 76 | +build:dev --config=debug |
| 77 | +build:dev --compilation_mode=dbg |
| 78 | +build:dev --strip=never |
| 79 | + |
| 80 | +# Release Configuration (explicit) |
| 81 | +build:release --compilation_mode=opt |
| 82 | +build:release --copt=-O3 |
| 83 | +build:release --copt=-DNDEBUG |
| 84 | +build:release --strip=always |
| 85 | + |
| 86 | +# ============================================================================= |
| 87 | +# Sanitizer Configurations |
| 88 | +# ============================================================================= |
| 89 | +# Address Sanitizer |
| 90 | +build:asan --strip=never |
| 91 | +build:asan --copt=-fsanitize=address |
| 92 | +build:asan --copt=-DADDRESS_SANITIZER |
| 93 | +build:asan --copt=-O1 |
| 94 | +build:asan --copt=-fno-omit-frame-pointer |
| 95 | +build:asan --linkopt=-fsanitize=address |
| 96 | + |
| 97 | +# Thread Sanitizer |
| 98 | +build:tsan --strip=never |
| 99 | +build:tsan --copt=-fsanitize=thread |
| 100 | +build:tsan --copt=-DTHREAD_SANITIZER |
| 101 | +build:tsan --copt=-O1 |
| 102 | +build:tsan --copt=-fno-omit-frame-pointer |
| 103 | +build:tsan --linkopt=-fsanitize=thread |
| 104 | + |
| 105 | +# Memory Sanitizer |
| 106 | +build:msan --strip=never |
| 107 | +build:msan --copt=-fsanitize=memory |
| 108 | +build:msan --copt=-DMEMORY_SANITIZER |
| 109 | +build:msan --copt=-O1 |
| 110 | +build:msan --copt=-fno-omit-frame-pointer |
| 111 | +build:msan --linkopt=-fsanitize=memory |
| 112 | + |
| 113 | +# Undefined Behavior Sanitizer |
| 114 | +build:ubsan --strip=never |
| 115 | +build:ubsan --copt=-fsanitize=undefined |
| 116 | +build:ubsan --copt=-DUNDEFINED_BEHAVIOR_SANITIZER |
| 117 | +build:ubsan --copt=-O1 |
| 118 | +build:ubsan --copt=-fno-omit-frame-pointer |
| 119 | +build:ubsan --linkopt=-fsanitize=undefined |
| 120 | + |
| 121 | +# ============================================================================= |
| 122 | +# Platform Specific Settings |
| 123 | +# ============================================================================= |
| 124 | +# Darwin (macOS) Settings |
| 125 | +build:darwin --cxxopt=-mmacosx-version-min=15.2 |
| 126 | +build:darwin --linkopt=-mmacosx-version-min=15.2 |
| 127 | +build:darwin --action_env=CC=clang |
| 128 | +build:darwin --action_env=CXX=clang++ |
| 129 | + |
| 130 | +# Linux Settings |
| 131 | +build:linux --action_env=CC=clang |
| 132 | +build:linux --action_env=CXX=clang++ |
| 133 | +build:linux --action_env=LD=clang |
| 134 | +build:linux --action_env=LDXX=clang++ |
| 135 | +build:linux --cxxopt=-D_LINUX |
| 136 | +build:linux --copt=-fPIC |
| 137 | +# CUDA Settings (A6000, A100, H100) |
| 138 | +build:linux --@rules_cuda//cuda:archs=compute_80,sm_80,compute_86,sm_86,compute_90,sm_90 |
| 139 | + |
| 140 | +# Windows Settings |
| 141 | +build:windows --cxxopt=/D_WINDOWS |
| 142 | + |
| 143 | +# ============================================================================= |
| 144 | +# Import Local Settings |
| 145 | +# ============================================================================= |
| 146 | +try-import %workspace%/.bazelrc.local |
0 commit comments