Skip to content

Commit

Permalink
change pacboy compiler target for windows builds (#1915)
Browse files Browse the repository at this point in the history
* change pacboy compiler target for windows builds

* use an action for cmake instead of doing things manually

* set compiler for cmake

* remove cmake action from msys2 build

* readd cmake package for msys2

* fix cmake test path to match build

* fix msvc build type setting

* fix msvc build type setting

* consistent output directory for msvc

* remove legacy environments (https://www.msys2.org/docs/environments/\#__tabbed_1_2)

* remove shell overrides and depend on default for msys2
  • Loading branch information
dmah42 authored Feb 5, 2025
1 parent 2e16afc commit 47bc26c
Showing 1 changed file with 22 additions and 39 deletions.
61 changes: 22 additions & 39 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: lukka/get-cmake@latest

- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build

- name: setup cmake initial cache
run: touch compiler-cache.cmake

- name: configure cmake
env:
CXX: ${{ matrix.compiler }}
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: >
cmake -C ${{ github.workspace }}/compiler-cache.cmake
$GITHUB_WORKSPACE
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_CXX_COMPILER=${{ env.CXX }}
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON
- name: build
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}
uses: threeal/cmake-action@v2.1.0
with:
build-dir: ${{ runner.workspace }}/_build
cxx-compiler: ${{ matrix.compiler }}
options: |
BENCHMARK_DOWNLOAD_DEPENDENCIES=ON
BUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
CMAKE_BUILD_TYPE=${{ matrix.build_type }}
CMAKE_CXX_COMPILER=${{ matrix.compiler }}
CMAKE_CXX_VISIBILITY_PRESET=hidden
CMAKE_VISIBILITY_INLINES_HIDDEN=ON
- name: test
shell: bash
Expand All @@ -70,8 +55,6 @@ jobs:
msvc:
- VS-16-2019
- VS-17-2022
arch:
- x64
build_type:
- Debug
- Release
Expand All @@ -93,17 +76,16 @@ jobs:

- name: configure cmake
run: >
cmake -S . -B _build/
-A ${{ matrix.arch }}
cmake -S . -B ${{ runner.workspace }}/_build/
-G "${{ matrix.generator }}"
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
- name: build
run: cmake --build _build/ --config ${{ matrix.build_type }}
run: cmake --build ${{ runner.workspace }}/_build/ --config ${{ matrix.build_type }}

- name: test
run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV
run: ctest --test-dir ${{ runner.workspace }}/_build/ -C ${{ matrix.build_type }} -VV

msys2:
name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }}
Expand All @@ -117,9 +99,7 @@ jobs:
os: [ windows-latest ]
msys2:
- { msystem: MINGW64, arch: x86_64, family: GNU, compiler: g++ }
- { msystem: MINGW32, arch: i686, family: GNU, compiler: g++ }
- { msystem: CLANG64, arch: x86_64, family: LLVM, compiler: clang++ }
- { msystem: CLANG32, arch: i686, family: LLVM, compiler: clang++ }
- { msystem: UCRT64, arch: x86_64, family: GNU, compiler: g++ }
build_type:
- Debug
Expand All @@ -129,9 +109,7 @@ jobs:
- static

steps:
- uses: actions/checkout@v4

- name: Install Base Dependencies
- name: setup msys2
uses: msys2/setup-msys2@v2
with:
cache: false
Expand All @@ -141,10 +119,14 @@ jobs:
git
base-devel
pacboy: >-
cc:p
gcc:p
clang:p
cmake:p
ninja:p
- uses: actions/checkout@v4

# NOTE: we can't use cmake actions here as we need to do everything in msys2 shell.
- name: configure cmake
env:
CXX: ${{ matrix.msys2.compiler }}
Expand All @@ -158,4 +140,5 @@ jobs:
run: cmake --build _build/ --config ${{ matrix.build_type }}

- name: test
run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV
working-directory: _build
run: ctest -C ${{ matrix.build_type }} -VV

0 comments on commit 47bc26c

Please sign in to comment.