From 47bc26c8b5ca1f043641ec51d54858402807d107 Mon Sep 17 00:00:00 2001 From: dominic <510002+dmah42@users.noreply.github.com> Date: Wed, 5 Feb 2025 17:45:30 +0000 Subject: [PATCH] change pacboy compiler target for windows builds (#1915) * 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 --- .github/workflows/build-and-test.yml | 61 ++++++++++------------------ 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c32e799db9..8394d10129 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 @@ -70,8 +55,6 @@ jobs: msvc: - VS-16-2019 - VS-17-2022 - arch: - - x64 build_type: - Debug - Release @@ -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 }} @@ -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 @@ -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 @@ -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 }} @@ -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