diff --git a/.bazelrc b/.bazelrc index b5c7716..04ccd67 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,13 +1,17 @@ # Set up to use C++20. -build --cxxopt='-std=c++20' +build --cxxopt=-std=c++20' + +# Use the builtin crc32 for fast integer hashing. build --copt=-mcrc32 # Enable Bzlmod for every Bazel command common --enable_bzlmod -# Use the builtin crc32 for fast integer hashing. -build --copt=-mcrc32 - # To create this file, please run: # bazel run @com_google_fuzztest//bazel:setup_configs > fuzztest.bazelrc try-import %workspace%/fuzztest.bazelrc + +build:win_clang --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl +build:win_clang --extra_execution_platforms=//:x64_windows-clang-cl +build:win_clang --compiler=clang-cl +build:win_clang --cxxopt=/std:c++20 diff --git a/.github/workflows/bazel-test.yaml b/.github/workflows/bazel-test.yaml index 4210b37..3f7fbb0 100644 --- a/.github/workflows/bazel-test.yaml +++ b/.github/workflows/bazel-test.yaml @@ -7,7 +7,7 @@ jobs: bazel_test: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} @@ -15,4 +15,9 @@ jobs: - uses: actions/checkout@v4 - name: Test + if: runner.os != 'Windows' run: bazel test --test_output=errors //... + + - name: Test + if: runner.os == 'Windows' + run: bazel test --config=win_clang --test_output=errors //... diff --git a/BUILD b/BUILD index cefdd4d..05ca994 100644 --- a/BUILD +++ b/BUILD @@ -26,3 +26,14 @@ alias( actual = "@com_google_googletest//:gtest", visibility = ["//:__subpackages__"], ) + +# For building with clang-cl. +# https://bazel.build/configure/windows#clang +platform( + name = "x64_windows-clang-cl", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + "@bazel_tools//tools/cpp:clang-cl", + ], +)