mirror of
https://gitlab.com/raylibtemplates/rt.git
synced 2026-06-05 02:00:54 -04:00
Update cmake-multi-platform.yml
This commit is contained in:
126
.github/workflows/cmake-multi-platform.yml
vendored
126
.github/workflows/cmake-multi-platform.yml
vendored
@@ -13,46 +13,41 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-latest]
|
||||
build_type: [Release]
|
||||
c_compiler: [gcc, clang, cl, emcc]
|
||||
include:
|
||||
- os: windows-latest
|
||||
c_compiler: cl
|
||||
cpp_compiler: cl
|
||||
platform: Windows
|
||||
artifact_name: windows
|
||||
build_type: Release
|
||||
|
||||
- os: ubuntu-latest
|
||||
c_compiler: gcc
|
||||
cpp_compiler: g++
|
||||
platform: Linux-gcc
|
||||
artifact_name: linux-gcc
|
||||
build_type: Release
|
||||
|
||||
- os: ubuntu-latest
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
platform: Linux-clang
|
||||
artifact_name: linux-clang
|
||||
build_type: Release
|
||||
|
||||
- os: macos-latest
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
platform: MacOS
|
||||
artifact_name: macos
|
||||
build_type: Release
|
||||
|
||||
- os: ubuntu-latest
|
||||
c_compiler: emcc
|
||||
cpp_compiler: em++
|
||||
build_type: Release
|
||||
platform: Web
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
c_compiler: gcc
|
||||
- os: windows-latest
|
||||
c_compiler: clang
|
||||
- os: windows-latest
|
||||
c_compiler: emcc
|
||||
- os: ubuntu-latest
|
||||
c_compiler: cl
|
||||
- os: macos-latest
|
||||
c_compiler: gcc
|
||||
- os: macos-latest
|
||||
c_compiler: cl
|
||||
- os: macos-latest
|
||||
c_compiler: emcc
|
||||
artifact_name: web
|
||||
build_type: Release
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -63,6 +58,17 @@ jobs:
|
||||
run: |
|
||||
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
|
||||
|
||||
- name: Install MacOS Dependencies
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install cmake
|
||||
|
||||
- name: Cache CMake files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -89,6 +95,13 @@ jobs:
|
||||
uses: mymindstorm/setup-emsdk@v12
|
||||
with:
|
||||
actions-cache-folder: emsdk-cache
|
||||
version: 3.1.45
|
||||
|
||||
- name: Setup Web Build Environment
|
||||
if: matrix.c_compiler == 'emcc'
|
||||
run: |
|
||||
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/assets
|
||||
# cp -r assets/* ${{ steps.strings.outputs.build-output-dir }}/assets/
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
@@ -96,7 +109,7 @@ jobs:
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
|
||||
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
${{ matrix.c_compiler == 'emcc' && '-DPLATFORM=Web' || '' }}
|
||||
${{ matrix.c_compiler == 'emcc' && '-DPLATFORM=Web -DCMAKE_EXE_LINKER_FLAGS="-s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file assets --shell-file ../src/shell.html"' || '' }}
|
||||
-S ${{ github.workspace }}
|
||||
|
||||
- name: Build
|
||||
@@ -106,28 +119,20 @@ jobs:
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: ctest --build-config ${{ matrix.build_type }}
|
||||
|
||||
- name: Upload Web Build
|
||||
if: matrix.platform == 'Web'
|
||||
# For regular pushes, upload as artifacts
|
||||
- name: Upload Build Artifacts
|
||||
if: github.event_name != 'release'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.platform }}-build
|
||||
path: ${{ steps.strings.outputs.build-output-dir }}/*.html
|
||||
|
||||
- name: Upload Windows Build
|
||||
if: matrix.platform == 'Windows'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.platform }}-build
|
||||
path: ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.build_type }}/*.exe
|
||||
|
||||
- name: Upload Linux Build
|
||||
if: contains(matrix.platform, 'Linux')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.platform }}-build
|
||||
path: ${{ steps.strings.outputs.build-output-dir }}/*
|
||||
path: |
|
||||
${{ matrix.platform == 'Web' && format('{0}/*.{html,js,data}', steps.strings.outputs.build-output-dir) }}
|
||||
${{ matrix.platform == 'Windows' && format('{0}/{1}/*.exe', steps.strings.outputs.build-output-dir, matrix.build_type) }}
|
||||
${{ contains(matrix.platform, 'Linux') && format('{0}/*', steps.strings.outputs.build-output-dir) }}
|
||||
${{ matrix.platform == 'MacOS' && format('{0}/*', steps.strings.outputs.build-output-dir) }}
|
||||
assets/**
|
||||
exclude: |
|
||||
**/*.cmake
|
||||
${{ contains(matrix.platform, 'Linux') || matrix.platform == 'MacOS' ? '**/*.cmake
|
||||
**/*.txt
|
||||
**/*.json
|
||||
**/*.a
|
||||
@@ -139,25 +144,30 @@ jobs:
|
||||
**/Makefile
|
||||
**/.ninja*
|
||||
**/*.ninja
|
||||
**/CMakeFiles/**
|
||||
**/CMakeFiles/**' : '' }}
|
||||
|
||||
- name: Upload MacOS Build
|
||||
if: matrix.platform == 'MacOS'
|
||||
uses: actions/upload-artifact@v4
|
||||
# For releases, create ZIP files and upload to the release
|
||||
- name: Create Release ZIP
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
cd ${{ steps.strings.outputs.build-output-dir }}
|
||||
if [ "${{ matrix.platform }}" = "Web" ]; then
|
||||
zip -r ../${{ matrix.artifact_name }}.zip *.html *.js *.data
|
||||
elif [ "${{ matrix.platform }}" = "Windows" ]; then
|
||||
cd ${{ matrix.build_type }}
|
||||
zip -r ../../${{ matrix.artifact_name }}.zip *.exe
|
||||
else
|
||||
zip -r ../${{ matrix.artifact_name }}.zip * -x "*.cmake" "*.txt" "*.json" "*.a" "*.o" "*.d" "*.make" "*.internal" "*.marks" "Makefile" ".ninja*" "*.ninja" "CMakeFiles/*"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Upload Release Asset
|
||||
if: github.event_name == 'release'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: ${{ matrix.platform }}-build
|
||||
path: ${{ steps.strings.outputs.build-output-dir }}/*
|
||||
exclude: |
|
||||
**/*.cmake
|
||||
**/*.txt
|
||||
**/*.json
|
||||
**/*.a
|
||||
**/*.o
|
||||
**/*.d
|
||||
**/*.make
|
||||
**/*.internal
|
||||
**/*.marks
|
||||
**/Makefile
|
||||
**/.ninja*
|
||||
**/*.ninja
|
||||
**/CMakeFiles/**
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ${{ matrix.artifact_name }}.zip
|
||||
asset_name: ${{ matrix.artifact_name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
Reference in New Issue
Block a user