| # This file is licensed under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| |
| ############################################################################### |
| # Common flags that apply to all configurations. |
| # Use sparingly for things common to all compilers and platforms. |
| ############################################################################### |
| # Prevent invalid caching if input files are modified during a build. |
| build --experimental_guard_against_concurrent_changes |
| |
| ############################################################################### |
| # Options to select different strategies for linking potential dependent |
| # libraries. The default leaves it disabled. |
| ############################################################################### |
| |
| build:zlib_external --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=external |
| build:zlib_system --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=system |
| |
| build:terminfo_external --repo_env=BAZEL_LLVM_TERMINFO_STRATEGY=external |
| build:terminfo_system --repo_env=BAZEL_LLVM_TERMINFO_STRATEGY=system |
| |
| ############################################################################### |
| # Options for "generic_clang" builds: these options should generally apply to |
| # builds using a Clang-based compiler, and default to the `clang` executable on |
| # the `PATH`. While these are provided for convenience and may serve as a |
| # reference, it would be preferable for users to configure an explicit C++ |
| # toolchain instead of relying on `.bazelrc` files. |
| ############################################################################### |
| |
| # Set the default compiler to the `clang` binary on the `PATH`. |
| build:generic_clang --repo_env=CC=clang |
| |
| # C++14 standard version is required. |
| build:generic_clang --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 |
| |
| # The Clang available on MacOS has a warning that isn't clean on MLIR code. The |
| # warning doesn't show up with more recent Clangs, so just disable for now. |
| build:generic_clang --cxxopt=-Wno-range-loop-analysis --host_cxxopt=-Wno-range-loop-analysis |
| |
| # Use `-Wall` and `-Werror` for Clang. |
| build:generic_clang --copt=-Wall --copt=-Werror --host_copt=-Wall --host_copt=-Werror |
| # This doesn't appear to be enforced by any upstream bot. |
| build:generic_clang --copt=-Wno-unused --host_copt=-Wno-unused |
| |
| ############################################################################### |
| # Options for "generic_gcc" builds: these options should generally apply to |
| # builds using a GCC-based compiler, and default to the `gcc` executable on |
| # the `PATH`. While these are provided for convenience and may serve as a |
| # reference, it would be preferable for users to configure an explicit C++ |
| # toolchain instead of relying on `.bazelrc` files. |
| ############################################################################### |
| |
| # Set the default compiler to the `gcc` binary on the `PATH`. |
| build:generic_gcc --repo_env=CC=gcc |
| |
| # C++14 standard version is required. |
| build:generic_gcc --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 |
| |
| # Disable GCC warnings that are noisy and/or false positives on LLVM code. |
| # These need to be global as some code triggering these is in header files. |
| build:generic_gcc --copt=-Wno-unused-parameter --host_copt=-Wno-unused-parameter |
| build:generic_gcc --copt=-Wno-comment --host_copt=-Wno-comment |
| build:generic_gcc --cxxopt=-Wno-class-memaccess --host_cxxopt=-Wno-class-memaccess |
| build:generic_gcc --copt=-Wno-maybe-uninitialized --host_copt=-Wno-maybe-uninitialized |
| build:generic_gcc --copt=-Wno-misleading-indentation --host_copt=-Wno-misleading-indentation |
| |
| # Use `-Werror` for GCC to make sure warnings don't slip past. |
| build:generic_gcc --copt=-Werror --host_copt=-Werror |
| |
| ############################################################################### |
| # Windows specific flags for building with VC. |
| ############################################################################### |
| |
| build:msvc --copt=/WX --host_copt=/WX # Treat warnings as errors... |
| # ...but disable the ones that are violated |
| build:msvc --copt=/wd4141 --host_copt=/wd4141 # inline used more than once |
| build:msvc --copt=/wd4244 --host_copt=/wd4244 # conversion type -> type |
| build:msvc --copt=/wd4267 --host_copt=/wd4267 # conversion size_t -> type |
| build:msvc --copt=/wd4273 --host_copt=/wd4273 # multiple definitions with different dllimport |
| build:msvc --copt=/wd4319 --host_copt=/wd4319 # zero-extending after complement |
| build:msvc --copt=/wd4624 --host_copt=/wd4624 # destructor was implicitly defined as deleted |
| build:msvc --copt=/wd4804 --host_copt=/wd4804 # comparisons between bool and int |
| build:msvc --copt=/wd4805 --host_copt=/wd4805 # comparisons between bool and int |
| |
| build:msvc --linkopt=/WX --host_linkopt=/WX # Treat warnings as errors... |
| # ...but disable the ones that are violated. |
| build:msvc --linkopt=/IGNORE:4001 --host_linkopt=/IGNORE:4001 # no object files |
| |
| # Yay for security warnings. Boo for non-standard. |
| build:msvc --copt=/D_CRT_SECURE_NO_WARNINGS --host_copt=/D_CRT_SECURE_NO_WARNINGS |
| |
| ############################################################################### |
| |
| ############################################################################### |
| # Configuration for building remotely using Remote Build Execution (RBE) |
| # Based on https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-1.0.0.bazelrc |
| ############################################################################### |
| |
| build:rbe --remote_instance_name=projects/llvm-bazel/instances/default_instance |
| |
| # Depending on how many machines are in the remote execution instance, setting |
| # this higher can make builds faster by allowing more jobs to run in parallel. |
| # Setting it too high can result in jobs that timeout, however, while waiting |
| # for a remote machine to execute them. |
| build:rbe --jobs=150 |
| |
| # Set several flags related to specifying the platform, toolchain and java |
| # properties. |
| # These flags should only be used as is for the rbe-ubuntu16-04 container |
| # and need to be adapted to work with other toolchain containers. |
| build:rbe --host_javabase=@rbe_default//java:jdk |
| build:rbe --javabase=@rbe_default//java:jdk |
| build:rbe --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 |
| build:rbe --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 |
| build:rbe --crosstool_top=@rbe_default//cc:toolchain |
| build:rbe --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| # Platform flags: |
| # The toolchain container used for execution is defined in the target indicated |
| # by "extra_execution_platforms", "host_platform" and "platforms". |
| # More about platforms: https://docs.bazel.build/versions/master/platforms.html |
| build:rbe --extra_toolchains=@rbe_default//config:cc-toolchain |
| build:rbe --extra_execution_platforms=@rbe_default//config:platform |
| build:rbe --host_platform=@rbe_default//config:platform |
| build:rbe --platforms=@rbe_default//config:platform |
| |
| build:rbe --define=EXECUTOR=remote |
| |
| # Enable remote execution so actions are performed on the remote systems. |
| build:rbe --remote_executor=grpcs://remotebuildexecution.googleapis.com |
| |
| # Enforce stricter environment rules, which eliminates some non-hermetic |
| # behavior and therefore improves both the remote cache hit rate and the |
| # correctness and repeatability of the build. |
| build:rbe --incompatible_strict_action_env=true |
| |
| # Set a higher timeout value, just in case. |
| build:rbe --remote_timeout=3600 |
| |
| # Local disk cache is incompatible with remote execution (for obvious reasons). |
| build:rbe --disk_cache="" |
| |
| # Enable authentication. This will pick up application default credentials by |
| # default. You can use --google_credentials=some_file.json to use a service |
| # account credential instead. |
| build:rbe --google_default_credentials=true |
| |
| # The user.bazelrc file is not checked in but available for local mods. |
| # Always keep this at the end of the file so that user flags override. |
| try-import %workspace%/user.bazelrc |