blob: d8c1d51f8876634d1638c5b71dd724cde1fce412 [file] [log] [blame]
# 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
# Windows-specific configuration.
build:windows --cxxopt=/std:c++17
build:windows --copt=/W4
build:windows --copt=/WX
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