forked from flibitijibibo/SDL2-CS
-
Notifications
You must be signed in to change notification settings - Fork 27
151 lines (146 loc) · 7.5 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
name: build-native
on:
workflow_dispatch:
inputs: {}
# 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, cmake_configure_env: CFLAGS=-m32 CXXFLAGS=-m32, target_apt_arch: ":i386" }
- { 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:
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
if [[ ${{ matrix.platform.target_apt_arch }} == :i386 ]]; then
sudo dpkg --add-architecture i386
fi
sudo apt-get update -y -qq
if [[ ${{ matrix.platform.target_apt_arch }} == :i386 ]]; then
# Workaround GitHub's ubuntu-20.04 image issue <https://github.com/actions/virtual-environments/issues/4589>
sudo apt-get install -y --allow-downgrades libpcre2-8-0=10.34-7
fi
sudo apt-get install -y \
gcc-multilib \
g++-multilib \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
pkg-config${{ matrix.platform.target_apt_arch }} \
libasound2-dev${{ matrix.platform.target_apt_arch }} \
libdbus-1-dev${{ matrix.platform.target_apt_arch }} \
libegl1-mesa-dev${{ matrix.platform.target_apt_arch }} \
libgl1-mesa-dev${{ matrix.platform.target_apt_arch }} \
libgles2-mesa-dev${{ matrix.platform.target_apt_arch }} \
libglu1-mesa-dev${{ matrix.platform.target_apt_arch }} \
libibus-1.0-dev${{ matrix.platform.target_apt_arch }} \
libpulse-dev${{ matrix.platform.target_apt_arch }} \
libsdl2-2.0-0${{ matrix.platform.target_apt_arch }} \
libsndio-dev${{ matrix.platform.target_apt_arch }} \
libudev-dev${{ matrix.platform.target_apt_arch }} \
libwayland-dev${{ matrix.platform.target_apt_arch }} \
libx11-dev${{ matrix.platform.target_apt_arch }} \
libxcursor-dev${{ matrix.platform.target_apt_arch }} \
libxext-dev${{ matrix.platform.target_apt_arch }} \
libxi-dev${{ matrix.platform.target_apt_arch }} \
libxinerama-dev${{ matrix.platform.target_apt_arch }} \
libxkbcommon-dev${{ matrix.platform.target_apt_arch }} \
libxrandr-dev${{ matrix.platform.target_apt_arch }} \
libxss-dev${{ matrix.platform.target_apt_arch }} \
libxt-dev${{ matrix.platform.target_apt_arch }} \
libxv-dev${{ matrix.platform.target_apt_arch }} \
libxxf86vm-dev${{ matrix.platform.target_apt_arch }} \
libdrm-dev${{ matrix.platform.target_apt_arch }} \
libgbm-dev${{ matrix.platform.target_apt_arch }} \
libpulse-dev${{ matrix.platform.target_apt_arch }}
- uses: actions/checkout@v4
with:
repository: 'libsdl-org/SDL'
ref: 'SDL2'
- uses: actions/checkout@v4
with:
path: 'SDL2-CS'
- name: Configure CMake
run: ${{ matrix.platform.cmake_configure_env }} cmake -B build ${{ matrix.platform.flags }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
- name: Build
run: cmake --build build/ --config Release
- name: Install (Windows)
run: cmake --install build/ --prefix install_output --config Release
if: runner.os == 'Windows'
- name: Install
run: sudo cmake --install build/ --prefix install_output --config Release
if: runner.os != 'Windows'
- name: Prepare release directory (Windows)
run: mkdir -Force SDL2-CS/native/${{ matrix.platform.name }}
if: runner.os == 'Windows'
- name: Prepare release directory
run: mkdir -p SDL2-CS/native/${{ matrix.platform.name }}
if: runner.os != 'Windows'
- name: Prepare release (Windows)
run: cp install_output/bin/SDL2.dll SDL2-CS/native/${{ matrix.platform.name }}/SDL2.dll
if: runner.os == 'Windows'
- name: Prepare release (Linux)
run: cp install_output/lib/libSDL2-2.0.so.0 SDL2-CS/native/${{ matrix.platform.name }}/libSDL2.so
if: runner.os == 'Linux'
- name: Prepare release (macOS)
run: cp install_output/lib/libSDL2-2.0.dylib SDL2-CS/native/${{ matrix.platform.name }}/libSDL2.dylib
if: runner.os == 'macOS'
- 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: 'SDL2-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: 'SDL2'
- uses: actions/checkout@v4
with:
path: 'SDL2-CS'
- name: Build (iOS)
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -scheme xcFramework-iOS -configuration Release
- name: Prepare release directory (iOS)
run: mkdir -p SDL2-CS/native/ios
- name: Prepare release (iOS)
run: |
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework;
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework;
cp Xcode/SDL/Products/SDL2.xcframework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/Info.plist;
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2;
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist;
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2;
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.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-genereated to update the iOS SDL binaries
branch: update-ios-binaries
path: 'SDL2-CS'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'