Skip to content

Build

Build #7

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
platform: [native, web]
build-type: [debug, release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: false
- uses: seanmiddleditch/gha-setup-ninja@master
# Install Vcpkg (submodule seems not working?)
- uses: actions/checkout@v4
with:
repository: 'microsoft/vcpkg'
path: 'vcpkg'
- name: Set strings
id: strings
run: |
echo "build-dir=${{ github.workspace }}/build" >> $GITHUB_OUTPUT
echo "build-dir-web=${{ github.workspace }}/build-wasm" >> $GITHUB_OUTPUT
- name: Bootstrap vcpkg
run: |
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh
- name: Install CMake and other dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential
- name: Install CMake on macOS
if: matrix.os == 'macos-latest'
run: |
brew install cmake
- name: Install EMSDK
if: matrix.platform == 'web'
run: |
git clone https://github.com/emscripten-core/emsdk.git
${{ github.workspace }}/emsdk/emsdk install latest
${{ github.workspace }}/emsdk/emsdk activate latest
echo "EMSDK=${{ github.workspace }}/emsdk" >> $GITHUB_ENV
- name: CMake Configure for Native
if: matrix.platform == 'native'
run: >
cmake -G Ninja
-S ${{ github.workspace }}
-B ${{ steps.strings.outputs.build-dir }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: CMake Build for Native
if: matrix.platform == 'native'
run: cmake --build ${{ steps.strings.outputs.build-dir }}
- name: CMake Configure for Web
if: matrix.platform == 'web'
run: >
cmake -G Ninja
-S ${{ github.workspace }}
-B ${{ steps.strings.outputs.build-dir-web }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DEMSCRIPTEN=ON
- name: CMake Build for Web
if: matrix.platform == 'web'
run: cmake --build ${{ steps.strings.outputs.build-dir-web }}