From f93822f302bd92b64d169672f9a343cd846ed346 Mon Sep 17 00:00:00 2001 From: Jan Henke Date: Sun, 22 Dec 2024 23:08:57 +0100 Subject: [PATCH] GH actions: New try with macOS --- .github/workflows/cmake-multi-platform.yml | 41 ++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 28882e8..9628949 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -18,15 +18,16 @@ jobs: fail-fast: false matrix: - os: [ ubuntu-24.04, windows-latest ] + os: [ macos-latest, ubuntu-latest, windows-latest ] toolchain: [ GNU, LLVM, MSVC ] build_type: [ Debug, Release ] - c_compiler: [cl, clang, gcc] include: - - os: ubuntu-24.04 + - os: macos-latest + toolchain: LLVM + - os: ubuntu-latest toolchain: GNU - c_compiler: gcc-14 - cpp_compiler: g++-14 + c_compiler: gcc + cpp_compiler: g++ - os: windows-latest toolchain: LLVM msvc_toolchain: ClangCL @@ -34,9 +35,13 @@ jobs: toolchain: MSVC msvc_toolchain: v143 exclude: - - os: ubuntu-24.04 + - os: macos-latest + toolchain: GNU + - os: macos-latest + toolchain: MSVC + - os: ubuntu-latest toolchain: LLVM - - os: ubuntu-24.04 + - os: ubuntu-latest toolchain: MSVC - os: windows-latest toolchain: GNU @@ -48,7 +53,7 @@ jobs: core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. @@ -57,19 +62,35 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + - name: Install ninja on macOS + if: runner.os == 'macOS' + run: brew install ninja + - name: Install pkg-config on Windows if: runner.os == 'Windows' run: choco install pkgconfiglite + - name: Configure CMake (macOS) + if: runner.os == 'macOS' + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G 'Ninja' + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_MAKE_PROGRAM=ninja + -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + -S ${{ github.workspace }} + - name: Configure CMake (Linux) if: runner.os == 'Linux' # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}‚ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -S ${{ github.workspace }}