Skip to content

Adapt CMakeLists to emscripten #53

Adapt CMakeLists to emscripten

Adapt CMakeLists to emscripten #53

Workflow file for this run

name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs:
build:
strategy:
fail-fast: false
matrix:
system: [ Linux-x64, Windows-MSVC-x64, Windows-MSYS-x64, MacOS-x64, MacOS-ARM ]
webgpu-backend: [ DAWN, WGPU ]
link-type: [ SHARED, STATIC ]
build-type: [ Debug, Release ]
include:
- system: Linux-x64
runner: ubuntu-latest
install-deps: |
sudo apt-get update -y
sudo apt-get install -y libwayland-dev libxkbcommon-dev xorg-dev
- system: Windows-MSVC-x64
runner: windows-latest
exe-extension: .exe
is-multiconfig: true
- system: Windows-MSYS-x64
runner: windows-latest
msystem: ucrt64
exe-extension: .exe
- system: MacOS-ARM
runner: macos-latest
- system: MacOS-x64
runner: macos-13
- system: emscripten
runner: ubuntu-latest
webgpu-backend: EMSCRIPTEN
link-type: STATIC
build-type: Release
cmake-wrapper: emcmake
# Latest version of Dawn to not support static linking
exclude:
- webgpu-backend: DAWN
link-type: STATIC
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
if: ${{ matrix.install-deps }}
run: ${{ matrix.install-deps }}
- name: Setup MSYS
if: ${{ matrix.msystem }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
pacboy: >-
toolchain:p
cmake:p
ninja:p
- name: Setup emscripten
if: ${{ matrix.emsdk-version }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ matrix.emsdk-version }}
- name: Configure CMake
if: ${{ ! matrix.msystem }}
run: >
${{ matrix.cmake-wrapper }} cmake
-S examples
-B build
-DWEBGPU_BACKEND=${{ matrix.webgpu-backend }}
-D${{ matrix.webgpu-backend }}_LINK_TYPE=${{ matrix.link-type }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: Build
if: ${{ ! matrix.msystem }}
run: >
cmake
--build build
--config ${{ matrix.build-type }}
# This is a hack to work around the lack of ${{ variables }} in 'shell' parameter
# We use the SHELL env variable as the value of 'shell'
- name: Configure CMake (MSYS)
if: ${{ matrix.msystem }}
shell: msys2 {0}
run: >
cmake
-S examples
-B build
-DWEBGPU_BACKEND=${{ matrix.webgpu-backend }}
-D${{ matrix.webgpu-backend }}_LINK_TYPE=${{ matrix.link-type }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: Build (MSYS)
if: ${{ matrix.msystem }}
shell: msys2 {0}
run: >
cmake
--build build
--config ${{ matrix.build-type }}