forked from ppy/SDL3-CS
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (174 loc) · 7.46 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build Native
on:
workflow_dispatch:
inputs:
sdl_ref:
description: SDL3 commit/branch/tag to build
required: true
# schedule:
# - cron: '0 0 * * *'
env:
BUILD_TYPE: Release
jobs:
build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- { name: win-x64, os: windows-latest, flags: -A x64 }
- { name: win-x86, os: windows-latest, flags: -A Win32 }
- { name: win-arm64, os: windows-latest, flags: -A ARM64 }
- { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64"}
- { name: linux-x86, os: ubuntu-20.04, flags: -GNinja -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32", target_apt_arch: ":i386" }
- { name: linux-arm64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":arm64", container: arm64v8/ubuntu }
- { name: linux-arm, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":armhf", container: arm32v7/ubuntu }
- { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 }
# NOTE: macOS 11.0 is the first released supported by Apple Silicon.
- { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 }
steps:
- uses: actions/checkout@v4
with:
repository: 'libsdl-org/SDL'
ref: ${{ sdl_Ref }}
- uses: actions/checkout@v4
with:
path: 'SDL3-CS'
- name: Set up QEMU
if: contains(matrix.platform.container, 'arm')
uses: docker/setup-qemu-action@v3
- name: Build (Linux ARM)
if: contains(matrix.platform.container, 'arm')
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.platform.container }}
options: >
-v ${{ github.workspace }}:/workspace
-e NAME=${{ matrix.platform.name }}
-e TARGET_APT_ARCH=${{ matrix.platform.target_apt_arch }}
-e RUNNER_OS=${{ runner.os }}
-e FLAGS=${{ matrix.platform.flags }}
-e BUILD_TYPE=${{ env.BUILD_TYPE }}
run: |
cd /workspace
./SDL3-CS/build.sh
- name: Build
if: ${{ !contains(matrix.platform.container, 'arm') }}
shell: bash
env:
NAME: ${{ matrix.platform.name }}
TARGET_APT_ARCH: ${{ matrix.platform.target_apt_arch }}
RUNNER_OS: ${{ runner.os }}
FLAGS: ${{ matrix.platform.flags }}
run: ./SDL3-CS/build.sh
- name: Get Actions user id
if: runner.os == 'Linux'
id: get_uid
run: echo "uid=$(id -u $USER)" >> $GITHUB_OUTPUT
- name: Correct Ownership in GITHUB_WORKSPACE directory
if: runner.os == 'Linux'
uses: peter-murray/reset-workspace-ownership-action@v1
with:
user_id: ${{ steps.get_uid.outputs.uid }}
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update ${{ matrix.platform.name }} SDL binaries
title: Update ${{ matrix.platform.name }} SDL binaries
body: This PR has been auto-generated to update the ${{ matrix.platform.name }} SDL binaries.
branch: update-${{ matrix.platform.name }}-binaries
path: 'SDL3-CS'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
build-ios:
name: ios
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
repository: 'libsdl-org/SDL'
ref: ${{ sdl_ref }}
- uses: actions/checkout@v4
with:
path: 'SDL3-CS'
- name: Build (iOS)
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3.xcframework -configuration Release
- name: Prepare release directory (iOS)
run: mkdir -p SDL3-CS/native/ios
- name: Prepare release (iOS)
run: |
mkdir -p SDL3-CS/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework;
mkdir -p SDL3-CS/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework;
cp Xcode/SDL/build/SDL3.xcframework/Info.plist SDL3-CS/native/ios/SDL3.xcframework/Info.plist;
cp Xcode/SDL/build/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3 SDL3-CS/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/SDL3;
cp Xcode/SDL/build/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist SDL3-CS/native/ios/SDL3.xcframework/ios-arm64/SDL3.framework/Info.plist;
cp Xcode/SDL/build/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3 SDL3-CS/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/SDL3;
cp Xcode/SDL/build/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist SDL3-CS/native/ios/SDL3.xcframework/ios-arm64_x86_64-simulator/SDL3.framework/Info.plist;
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update iOS SDL binaries
title: Update iOS SDL binaries
body: This PR has been auto-generated to update the iOS SDL binaries
branch: update-ios-binaries
path: 'SDL3-CS'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
build-android:
name: android
runs-on: ubuntu-20.04
env:
NDK_VER: 23.1.7779620
PLATFORM_VER: android-34
steps:
- uses: actions/checkout@v4
with:
repository: 'libsdl-org/SDL'
ref: ${{ sdl_ref }}
- uses: actions/checkout@v4
with:
path: 'SDL3-CS'
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: microsoft
java-version: |
11
17
- name: Install Android SDK Manager
uses: android-actions/setup-android@v3
with:
packages: ''
- name: Install Android SDK
run: |
sdkmanager --install "platform-tools" "platforms;$PLATFORM_VER"
sdkmanager --install "ndk;$NDK_VER" --channel=3
- name: Build (Android)
run: |
export PATH=$ANDROID_HOME/ndk/$NDK_VER:$PATH
export OUTPUT=$PWD/SDL3-CS/native/android
rm -rf $OUTPUT && mkdir -p $OUTPUT
# Build SDL3
sed -i 's/abi=.*/abi="armeabi-v7a arm64-v8a x86 x86_64"/g' ./build-scripts/androidbuildlibs.sh
./build-scripts/androidbuildlibs.sh NDK_LIBS_OUT="$OUTPUT"
- name: Build SDL3 Android Java
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export PATH=$JAVA_HOME_11_X64/bin:$PATH
export OUTPUT=$PWD/SDL3-CS/SDL3-CS.Android/Jars/
rm -rf $OUTPUT && mkdir -p $OUTPUT
# Build SDL3 Android Java part
cd android-project/app/src/main/java
javac -cp $ANDROID_HOME/platforms/$PLATFORM_VER/android.jar -encoding utf8 org/libsdl/app/*.java
jar cvf $OUTPUT/SDL3AndroidBridge.jar org/libsdl/app/*.class
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update Android SDL binaries
title: Update Android SDL binaries
body: This PR has been auto-generated to update the Android SDL binaries
branch: update-android-binaries
path: 'SDL3-CS'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'