Skip to content

cmake-multi-platform #4

cmake-multi-platform

cmake-multi-platform #4

name: cmake-multi-platform
on:
workflow_dispatch:
jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-latest
triplet: x64-osx
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
- name: Setup MSVC environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Bootstrap vcpkg (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .\vcpkg\bootstrap-vcpkg.bat
- name: Bootstrap vcpkg (Unix)
if: runner.os != 'Windows'
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh
- name: Configure
shell: bash
run: >
cmake -S . -B build-matrix
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}
- name: Build
shell: bash
run: cmake --build build-matrix --parallel
- name: Test
shell: bash
run: ctest --test-dir build-matrix --output-on-failure