Skip to content

Commit

Permalink
Improve bazel build for Windows. (jbeder#1100)
Browse files Browse the repository at this point in the history
Windows builds need some defines being set to use the static linking.

Also add bazel builds and test to Github-CI.
  • Loading branch information
vehre-x41 authored Apr 27, 2022
1 parent 13626af commit 420c982
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ master ]
workflow_dispatch:
jobs:
build:
cmake-build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
Expand Down Expand Up @@ -39,3 +39,24 @@ jobs:
- name: Test
shell: bash
run: cd build && ctest --output-on-failure

bazel-build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Build
shell: bash
run: |
cd "${{ github.workspace }}"
bazel build :all
- name: Test
shell: bash
run: |
cd "${{ github.workspace }}"
bazel test test
7 changes: 7 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
yaml_cpp_defines = select({
# On Windows, ensure static linking is used.
"@platforms//os:windows": ["YAML_CPP_STATIC_DEFINE", "YAML_CPP_NO_CONTRIB"],
"//conditions:default": [],
})

cc_library(
name = "yaml-cpp_internal",
visibility = ["//:__subpackages__"],
Expand All @@ -11,4 +17,5 @@ cc_library(
includes = ["include"],
hdrs = glob(["include/**/*.h"]),
srcs = glob(["src/**/*.cpp", "src/**/*.h"]),
defines = yaml_cpp_defines,
)

0 comments on commit 420c982

Please sign in to comment.