Skip to content

Commit dad4f13

Browse files
authored
Create cmake-multi-platform.yml
1 parent 20f7678 commit dad4f13

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Link SDL2 Project
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, windows-latest, macos-latest]
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
repository: 'libsdl-org/SDL'
15+
ref: 'release-2.30.5'
16+
path: 'SDL'
17+
18+
- name: Checkout specific commit
19+
run: |
20+
cd SDL
21+
git checkout 2eef7ca
22+
23+
- name: Install dependencies on Ubuntu
24+
if: matrix.os == 'ubuntu-latest'
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y build-essential libasound2-dev libpulse-dev libx11-dev cmake
28+
29+
- name: Install dependencies on macOS
30+
if: matrix.os == 'macos-latest'
31+
run: |
32+
brew update
33+
brew install cmake
34+
35+
- name: Install dependencies on Windows
36+
if: matrix.os == 'windows-latest'
37+
run: |
38+
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
39+
40+
- name: Configure SDL2 with CMake
41+
run: cmake -S SDL -B build/SDL
42+
43+
- name: Build SDL2
44+
run: cmake --build build/SDL --config Release
45+
46+
- uses: actions/checkout@v2
47+
with:
48+
path: 'MyProject' # Replace with your project's path or name
49+
50+
- name: Configure Project with CMake
51+
run: cmake -S MyProject -B build/MyProject -DSDL2_DIR=build/SDL
52+
53+
- name: Build Project
54+
run: cmake --build build/MyProject --config Release
55+
56+
- name: Upload Artifacts
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: ${{ matrix.os }}-artifacts
60+
path: build/MyProject/**
61+
if-no-files-found: error # 'warn' or 'ignore' or 'error'

0 commit comments

Comments
 (0)