Skip to content

CMake on multiple platforms #32

CMake on multiple platforms

CMake on multiple platforms #32

# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms
on:
release:
types: [published]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, cl]
cpp_compiler: [g++, cl]
slang_release: [slang-2024.14.2-linux-x86_64.zip, slang-2024.14.2-windows-x86_64.zip]
slangc_exe: [slangc, slangc.exe]
exclude:
- os: windows-latest
c_compiler: gcc
- os: ubuntu-latest
c_compiler: cl
- os: windows-latest
cpp_compiler: g++
- os: ubuntu-latest
cpp_compiler: cl
- slang_release: slang-2024.14.2-windows-x86_64.zip
os: ubuntu-latest
- slang_release: slang-2024.14.2-linux-x86_64.zip
os: windows-latest
- slang_release: slang-2024.14.2-windows-x86_64.zip
slangc_exe: slangc
- slang_release: slang-2024.14.2-linux-x86_64.zip
slangc_exe: slangc.exe
steps:
- uses: actions/checkout@v4
- name: Install ubuntu build deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install xorg-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
- name: Download slangc
uses: robinraju/release-downloader@v1
with:
repository: 'shader-slang/slang'
tag: 'v2024.14.2'
fileName: ${{ matrix.slang_release }}
out-file-path: 'slangc'
extract: true
- name: Prepare Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
with:
version: 1.3.290.0
cache: true
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
- name: Build
id: build
uses: threeal/cmake-action@v2.0.0
with:
generator: Ninja
c-compiler: ${{ matrix.c_compiler }}
cxx-compiler: ${{ matrix.cpp_compiler }}
options: |
CMAKE_BUILD_TYPE=${{ matrix.build_type }}
SLANGC=${{ github.workspace }}/slangc/bin/${{ matrix.slangc_exe }}
- name: Archive
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: ${{ matrix.build_type }}-${{ github.ref_name }}-${{ matrix.os }}.zip
exclusions: ''
directory: ${{ steps.build.outputs.build-dir }}
- name: Upload
run: gh release upload ${{github.event.release.tag_name}} ${{ steps.build.outputs.build-dir }}/${{ matrix.build_type }}-${{ github.ref_name }}-${{ matrix.os }}.zip
env:
GITHUB_TOKEN: ${{ github.TOKEN }}