Skip to content

Commit

Permalink
add windows builds to bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Feb 10, 2025
1 parent 7137b3e commit fa2dd87
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
common --enable_platform_specific_config
build --verbose_failures

build --cxxopt="-std=c++20"

build:windows --cxxopt='/std:c++20' --host_cxxopt='/std:c++20' --compiler=clang-cl
15 changes: 13 additions & 2 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,25 @@ concurrency:
cancel-in-progress: true

jobs:
windows:
runs-on: windows-2025
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ runner.os }}
repository-cache: true
- name: Build & Test
run: bazel test //...
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
disk-cache: ${{ github.workflow }}-${{ runner.os }}
repository-cache: true
- name: Build & Test
run: bazel test //...
Expand All @@ -45,7 +56,7 @@ jobs:
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
disk-cache: ${{ github.workflow }}-${{ runner.os }}
repository-cache: true
- name: Build & Test
run: bazel test //...
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ benchmarks/competitors/servo-url/target

# bazel output
bazel-*
.clwb
12 changes: 12 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

# Platform definition for using clang-cl on Windows
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)

cc_library(
name = "ada",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.1")
24 changes: 5 additions & 19 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ cc_test(
"@googletest//:gtest_main",
],
)

cc_test(
name = "ada_c",
srcs = ["ada_c.cpp"],
deps = [
"//:ada",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)

0 comments on commit fa2dd87

Please sign in to comment.