Update cmake-multi-platform.yml #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake on multiple platforms | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
build_release: | ||
permissions: write | ||
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} | ||
runs-on: ${{ matrix.platform.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- { name: Windows VS2022, os: windows-2022, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } | ||
- { name: Linux GCC, os: ubuntu-latest } | ||
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } | ||
- { name: macOS, os: macos-latest } | ||
config: | ||
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } | ||
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install ninja-build tool | ||
uses: seanmiddleditch/gha-setup-ninja@v4 | ||
- name: Init submodules | ||
run: git submodule update --init --recursive | ||
- name: Install Linux Dependencies | ||
if: runner.os == 'Linux' | ||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev | ||
- name: Configure CMake | ||
run: cmake ${{ matrix.platform.flags }} ${{ matrix.config.flags }} --preset=release | ||
- name: Build | ||
run: cmake --build --preset=release-build | ||
- name: Package build file | ||
run: | | ||
cd build/release/ | ||
cpack | ||
- name: Create GitHub Release and upload artifacts | ||
shell: bash | ||
run: | | ||
cd ${{ github.workspace }}/build/release | ||
gh release create v2.0.x *.tar.gz *.zip | ||
env: | ||
GITHUB_TOKEN: ${{ github.TOKEN }} |