Skip to content

actions: fix cmake generator on macos #103

actions: fix cmake generator on macos

actions: fix cmake generator on macos #103

Workflow file for this run

name: build
on:
push:
branches:
- master
pull_request:
branches-ignore:
- '**pages**'
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
jobs:
build:
name: ${{ matrix.os }}-${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [RelWithDebInfo]
generator: [Ninja]
nice-arch: [x86_64]
include:
- os: ubuntu-latest
nice-name: "Ubuntu-Linux"
- os: macos-latest
generator: "Ninja"
nice-name: "macOS"
nice-arch: "arm64"
- os: windows-2022
build_type: RelWithDebInfo
generator: "Visual Studio 17 2022"
arch: x64
additional-cmake-args: -T v143 -A x64
nice-arch: "x86_64"
nice-name: "Windows7"
- os: windows-2019
build_type: RelWithDebInfo
generator: "Visual Studio 16 2019"
arch: x86
additional-cmake-args: -T v141_xp -A Win32
nice-arch: "i386"
nice-name: "WindowsXP"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialise MSVC environment
if: "contains(matrix.os, 'windows')"
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- uses: lukka/get-cmake@latest
- run: mkdir ${{ env.CPM_SOURCE_CACHE }}
- name: Cache multiple paths
uses: actions/cache@v4
with:
path: |
${{ env.CPM_SOURCE_CACHE }}
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/**/cmake_pch.*
key: ${{ matrix.os }}-${{ hashFiles('examples/sdl2/CMakeLists.txt','.github/workflows/peanut-sdl.yml') }}
- name: Build
run: |
cmake -S ./examples/sdl2/ -B ${{github.workspace}}/build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DLIBRARY_DISCOVER_METHOD=CPM ${{matrix.additional-cmake-args}}
cmake --build build --config ${{matrix.BUILD_TYPE}}
- name: Tar output on Unix systems
if: "contains(matrix.os, 'windows') == false"
run: |
cd ${{github.workspace}}/build
tar cf peanut-sdl.tar peanut-sdl*
- name: Get Short SHA
id: vars
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload output
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.nice-name }}-${{ matrix.nice-arch }}-${{ matrix.build_type }}-${{ steps.vars.outputs.sha_short }}
path: |
${{ github.workspace }}/build/peanut-sdl.tar
${{ github.workspace }}/build/**/peanut-sdl.exe
${{ github.workspace }}/build/**/peanut-sdl.pdb