common --enable_bzlmod # abc is driven programmatically by OpenROAD, so skip the interactive # readline dependency exposed by abc@0.64-yosyshq.bcr.2. common --@abc//:use_readline=false build --workspace_status_command=tools/workspace_status.sh # Release builds embed real git version info; dev builds use cache-safe placeholders. # Usage: bazel build --config=release //... build:release --stamp # suppress distracting warning about newer module # versions found in dependency graph. common --check_direct_dependencies=off # Test timeouts for various levels. test --test_timeout=300,1800,1800,9600 # bazel 7 is somewhat forgiving for glob patterns that don't # match, but bazel 8 will be strict. So start now. common --incompatible_disallow_empty_glob common --experimental_isolated_extension_usages common --incompatible_default_to_explicit_init_py build --cxxopt "-std=c++20" --host_cxxopt "-std=c++20" build --cxxopt "-xc++" --host_cxxopt "-xc++" build --cxxopt "-DBAZEL_BUILD" --host_cxxopt "-DBAZEL_BUILD" # Default to optimized build (-c opt) build -c opt # Settings for --config=opt build: Enable -O3 and Full-LTO for performance build:opt --copt=-O3 build:opt --copt=-flto build:opt --linkopt=-flto # Needed for floating point stability in FFT (fft_test will check this). # See also https://kristerw.github.io/2021/11/09/fp-contract/ build --cxxopt "-ffp-contract=off" --host_cxxopt "-ffp-contract=off" # allow exceptions. build --cxxopt=-fexceptions --host_cxxopt=-fexceptions # Turn warnings on... build --copt "-Wall" --host_copt "-Wall" build --copt "-Wextra" --host_copt "-Wextra" # Treat specific warnings as errors build --copt "-Werror=array-bounds" --host_copt "-Werror=array-bounds" build --copt "-Werror=dangling" --host_copt "-Werror=dangling" build --copt "-Werror=dangling-assignment" --host_copt "-Werror=dangling-assignment" build --copt "-Werror=dangling-assignment-gsl" --host_copt "-Werror=dangling-assignment-gsl" build --copt "-Werror=dangling-field" --host_copt "-Werror=dangling-field" build --copt "-Werror=dangling-gsl" --host_copt "-Werror=dangling-gsl" build --copt "-Werror=fortify-source" --host_copt "-Werror=fortify-source" build --copt "-Werror=return-stack-address" --host_copt "-Werror=return-stack-address" # ... and disable the warnings we're not interested in. build --copt "-Wno-sign-compare" --host_copt "-Wno-sign-compare" build --copt "-Wno-unused-parameter" --host_copt "-Wno-unused-parameter" # False positive under Bazel's parse_headers feature: it compiles each # declared header as a main TU, which makes clang treat #pragma once as # a no-op and emit -Wpragma-once-outside-header. Project convention is # #pragma once for all headers, so silence the warning project-wide. build --copt "-Wno-pragma-once-outside-header" --host_copt "-Wno-pragma-once-outside-header" build --copt "-Wno-gcc-compat" --host_copt "-Wno-gcc-compat" build --copt "-Wno-nullability-extension" --host_copt "-Wno-nullability-extension" build --copt "-Wno-deprecated-declarations" --host_copt "-Wno-deprecated-declarations" build --copt "-Wno-unused-local-typedef" --host_copt "-Wno-unused-local-typedef" build --cxxopt "-Wno-c++20-designator" --host_cxxopt "-Wno-c++20-designator" # The warning acceptance bar in CI for PRs is set by -Werror of a specific # version of some chosen compiler. Disable warnings from other compilers until # they are fixed and under CI -Werror acceptance critera as there is nothing the # developers can(they can't be reproduced locally or in CI) or should do about # these warnings in code they are not working on. build --copt "-Wno-cast-function-type-mismatch" --host_copt "-Wno-cast-function-type-mismatch" build --copt "-Wno-unused-but-set-variable" --host_copt "-Wno-unused-but-set-variable" build --cxxopt "-Wno-deprecated-copy" --host_cxxopt "-Wno-deprecated-copy" build --cxxopt "-Wno-deprecated-copy-with-user-provided-copy" --host_cxxopt "-Wno-deprecated-copy-with-user-provided-copy" # For 3rd party code: Disable warnings entirely. # They are not actionable and just create noise. build --per_file_copt=.*external/.*@-w build --host_per_file_copt=.*external/.*@-w # Treat include paths into external/ (bzlmod/BCR deps) as -isystem so clang # suppresses ALL warnings from third-party headers pulled into our TUs (boost, # Eigen, googletest, ...), regardless of the specific warning. The # per_file_copt -w above only covers compiling external *source* files; this # covers external *headers* included by our own sources. # # The feature is global (target and exec config) and also demotes a from-source # dep's own -iquote entries to -isystem. Tools that rely on -iquote precedence # to shadow libc headers are patched to restore it -- e.g. git's # builtin/get-tar-commit-id.c includes git's own tar.h, which must win over # glibc's . See the git single_version_override in MODULE.bazel (same # class of fix as the bison/sed/gawk/m4 -I-over-isystem overrides). build --features=external_include_paths # This avoid problems with building -c dbg which enables asserts. # Without this libstdc++ vs libc++ differences cause link errors. build --per_file_copt=.*external/abc.*@-stdlib=libc++ build --host_per_file_copt=.*external/abc.*@-stdlib=libc++ ##### Platform-specific configs (auto-selected) ############# # --enable_platform_specific_config makes bazel automatically apply # build:macos on macOS, build:linux on Linux, etc. common --enable_platform_specific_config # macOS: boost.stacktrace needs this since backtrace() doesn't require GNU source build:macos --copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED build:macos --host_copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED # Floating-point std::to_chars (behind std::format, used by OpenSTA) # needs macOS 13.3; std::filesystem (src/tcl_readline_setup.cc) needs # 10.15; abseil's aligned allocation needs 10.13. The historical 10.13 # floor was never enforced: toolchains_llvm ignored it and compiled # against the host SDK's default. hermetic-llvm honors it. build:macos --macos_minimum_os=13.3 build:macos --host_macos_minimum_os=13.3 # Settings for --config=asan address sanitizer build build:asan --strip=never build:asan --copt=-fsanitize=address build:asan --copt=-DADDRESS_SANITIZER build:asan --copt=-O1 build:asan --copt=-g build:asan --copt=-fno-omit-frame-pointer # Compress the DWARF debug sections (transparent to gdb/perf/addr2line). build:asan --copt=-gz=zlib build:asan --linkopt=-gz=zlib build:asan --linkopt=-fsanitize=address # TCMalloc is incompatible with ASan: __asan_init's interceptor setup calls # dlsym -> malloc before TCMalloc is initialized, segfaulting at startup. # Override the per-target malloc attribute to use the system allocator, which # ASan intercepts cleanly. build:asan --custom_malloc=@bazel_tools//tools/cpp:malloc # Flags with enough debug symbols to get useful outputs with Linux `perf` build:profile --strip=never build:profile --copt -g --host_copt -g build:profile --copt -gmlt --host_copt -gmlt build:profile --copt -fno-omit-frame-pointer --host_copt -fno-omit-frame-pointer # Compress the DWARF debug sections (transparent to gdb/perf/addr2line). build:profile --copt=-gz=zlib --host_copt=-gz=zlib build:profile --linkopt=-gz=zlib # Settings for --config=coverage C++ coverage build (LLVM source-based). # Usage: bazel coverage --config=coverage //... # `bazel coverage` already layers the `test` config on top of `build`, so this # only adds the coverage-specific bits. --combined_report=lcov merges every # test's per-target lcov into one file at # bazel-out/_coverage/_coverage_report.dat, which CI renders with genhtml # (lcov is installed in bazel/Dockerfile). The instrumentation_filter mirrors # the exclusions of the retired cmake/lcov flow (etc/CodeCoverage.sh _lcov): # instrument OpenROAD's own //src/... code, minus OpenSTA (src/sta, which has # its own private test suite) and drt's unused global-routing code. Third-party # deps live under external repos / //third-party and are simply never matched # by //src, so they need no explicit exclusion. # Instrumentation and the coverage tools come from the toolchain; requires # llvm >= 0.8.14 (see the bazel_dep note in MODULE.bazel). coverage:coverage --combined_report=lcov coverage:coverage --instrumentation_filter=//src[/:],-//src/sta[/:],-//src/drt/src/gr[/:],-//src/drt/src/db/grObj[/:] coverage:coverage --experimental_generate_llvm_lcov coverage:coverage --experimental_use_llvm_covmap # Skip the raw per-test coverage outputs: rules_cc leaves a dangling `gcov` # symlink there and fetching them fails. Drop once rules_cc >= 0.2.23 # (bazelbuild/rules_cc#795) is released. coverage:coverage --noexperimental_fetch_all_coverage_outputs # Improve hermeticity by disallowing user envars and network access build --incompatible_strict_action_env build --nosandbox_default_allow_network # Refuse to autodetect a local C++ toolchain (/usr/bin/gcc); the hermetic # toolchain must win resolution, with or without the etc/bazel-hermetic wrapper. common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 test --build_tests_only # --- Performance Optimizations --- # Use a high number of jobs and let the scheduler manage concurrency build --jobs=200 # Enable local disk caching to supplement the remote cache. build --disk_cache=~/.cache/bazel-disk-cache build --repository_cache=~/.cache/bazel-repository-cache # CI only needs to know if the build succeeded, not the artifacts themselves. build:ci --remote_download_minimal build:ci --remote_upload_local_results=true # Disable disk cache for CI builds build:ci --disk_cache= # Tell the 'ci' config to include 'opt' build:ci --config=opt # Launch py_binary via a shell stub instead of rules_python's legacy python # stub, whose '#!/usr/bin/env python3' shebang needs a host python3 before # the hermetic interpreter takes over (found by etc/bazel-hermetic). common --@rules_python//python/config_settings:bootstrap_impl=script # Setup remote cache # Anon: HTTPS read-only cache build --remote_cache=https://bazel.precisioninno.com build --remote_cache_compression=true build --remote_upload_local_results=false # CI: gRPC + Remote Asset API, requires --remote_header build:ci --remote_cache=grpcs://bazel.precisioninno.com:443 build:ci --experimental_remote_downloader=grpcs://bazel.precisioninno.com:443 # Without this, bazelisk build ... builds the bazel-orfs tests build --build_tag_filters=-orfs # clang-tidy via aspect_rules_lint, using clang-tidy from the LLVM toolchain. # Usage: bazel build --config=lint //src/utl/... build:lint --aspects=//tools/lint:linters.bzl%clang_tidy build:lint --output_groups=rules_lint_report build:lint --remote_download_outputs=all try-import %workspace%/user.bazelrc