diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2021-10-16 00:46:19 -0700 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2021-10-28 16:04:47 +0000 |
commit | 112dc16014f19ad68f54c59ad1170d71554c42f2 (patch) | |
tree | 573c41cb995928b2500eb8a7fc8d4674602c5ec2 /utils/bazel/.bazelrc | |
parent | 947e14be98796b5e680cc7bcae262d4256c8e05c (diff) | |
download | llvm-112dc16014f19ad68f54c59ad1170d71554c42f2.zip llvm-112dc16014f19ad68f54c59ad1170d71554c42f2.tar.gz llvm-112dc16014f19ad68f54c59ad1170d71554c42f2.tar.bz2 |
Add support for Bazel builds on Windows with `clang-cl`.
Adds basic `--config=clang-cl` to set up the basic options needed, and
then fix a number of issues that surface in Windows builds for me.
With these fixes, `//llvm/...` builds cleanly. One unittest still fails,
but its just due to running out of stack space due to creating a large
number of short-lived stack variables. The test should probably be
decomposed into a set of tests (`LegalizerInfoTest::RuleSets`), but that
seemed like too invasive of a change here and with everything building
cleanly this isn't disrupting me experimenting with Windows builds.
Some parts of `//clang/...` builds, but that will require more work.
Diffstat (limited to 'utils/bazel/.bazelrc')
-rw-r--r-- | utils/bazel/.bazelrc | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc index ce1d654..ed2a41d 100644 --- a/utils/bazel/.bazelrc +++ b/utils/bazel/.bazelrc @@ -69,9 +69,18 @@ build:generic_gcc --copt=-Wno-misleading-indentation --host_copt=-Wno-misleading build:generic_gcc --copt=-Werror --host_copt=-Werror ############################################################################### -# Windows specific flags for building with VC. +# Generic Windows flags common to both MSVC and Clang. ############################################################################### +# Yay for security warnings. Boo for non-standard. +build:windows --copt=/D_CRT_SECURE_NO_WARNINGS --host_copt=/D_CRT_SECURE_NO_WARNINGS + +############################################################################### +# Windows specific flags for building with MSVC. +############################################################################### + +build:msvc --config=windows + 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 @@ -87,8 +96,30 @@ 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 +############################################################################### +# Options for Windows `clang-cl` builds. +############################################################################### + +# We just start with the baseline Windows config as `clang-cl` doesn't accept +# some of the generic Clang flags. +build:clang-cl --config=windows + +# Switch from MSVC to the `clang-cl` compiler. +build:clang-cl --compiler=clang-cl + +# C++14 standard version is required. +build:clang-cl --cxxopt=/std:c++14 --host_cxxopt=/std:c++14 + +# Use Clang's internal warning flags instead of the ones that sometimes map +# through to MSVC's flags. +build:clang-cl --copt=/clang:-Wall --host_copt=/clang:-Wall +build:clang-cl --copt=/clang:-Werror --host_copt=/clang:-Werror + +# This doesn't appear to be enforced by any upstream bot. +build:clang-cl --copt=/clang:-Wno-unused --host_copt=/clang:-Wno-unused + +# There appears to be an unused constant in GoogleTest on Windows. +build:clang-cl --copt=/clang:-Wno-unused-const-variable --host_copt=/clang:-Wno-unused-const-variable ############################################################################### |