Skip to content

Commit 7a19b23

Browse files
committed
Created cmake.yml and cmake-android.yml
1 parent ddcd40b commit 7a19b23

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed

.github/workflows/cmake-android.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Build SDL2 Image Libraries (Android)
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
include:
11+
- os: ubuntu-latest
12+
arch: x86_64
13+
steps:
14+
15+
- uses: actions/checkout@v4.1.7
16+
with:
17+
repository: 'libsdl-org/SDL_image'
18+
path: 'SDLImage'
19+
ref: 'release-2.8.2'
20+
submodules: true
21+
22+
- uses: actions/checkout@v4.1.7
23+
with:
24+
repository: 'libsdl-org/SDL'
25+
ref: 'release-2.30.6'
26+
path: 'SDLImage/SDL2'
27+
28+
- name: Install dependencies on Ubuntu
29+
if: matrix.os == 'ubuntu-latest'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y build-essential cmake ninja-build
33+
34+
- name: Setup Java
35+
uses: actions/setup-java@v3
36+
with:
37+
distribution: 'temurin'
38+
java-version: 17
39+
40+
- name: Install Android SDK Command-Line Tools
41+
run: |
42+
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip -O android-sdk-tools.zip
43+
unzip android-sdk-tools.zip -d tools
44+
mkdir $HOME/android-sdk/
45+
mkdir $HOME/android-sdk/cmdline-tools/
46+
mkdir $HOME/android-sdk/cmdline-tools/latest/
47+
mv ./tools/cmdline-tools/* $HOME/android-sdk/cmdline-tools/latest/
48+
chmod +x $HOME/android-sdk/cmdline-tools/latest/bin/*
49+
echo "ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV
50+
echo "ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV
51+
52+
- name: Accept Android SDK Licenses
53+
run: |
54+
yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
55+
56+
57+
- name: Install Specific Android NDK Version 26.3.11579264
58+
run: |
59+
yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.3.11579264"
60+
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/26.3.11579264" >> $GITHUB_ENV
61+
echo "PATH=$PATH:$ANDROID_HOME/ndk/26.3.11579264" >> $GITHUB_ENV
62+
63+
- name: Build for arm64-v8a
64+
run: |
65+
cd SDLImage/SDL2
66+
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release \
67+
-DCMAKE_SYSTEM_NAME=Android \
68+
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME \
69+
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
70+
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
71+
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
72+
-DCMAKE_ANDROID_API=21 \
73+
-DANDROID_NDK=$ANDROID_NDK_HOME \
74+
-DSDL_STATIC=ON \
75+
-DSDL_SHARED=ON \
76+
-S ./ \
77+
-B ./build/arm64-v8a
78+
cmake --build ./build/arm64-v8a --config Release
79+
80+
- name: Build for x86_64
81+
run: |
82+
cd SDLImage/SDL2
83+
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release \
84+
-DCMAKE_SYSTEM_NAME=Android \
85+
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME \
86+
-DCMAKE_ANDROID_ARCH_ABI=x86_64 \
87+
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
88+
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
89+
-DCMAKE_ANDROID_API=21 \
90+
-DANDROID_NDK=$ANDROID_NDK_HOME \
91+
-DSDL_STATIC=ON \
92+
-DSDL_SHARED=ON \
93+
-S ./ \
94+
-B ./build/x86_64
95+
cmake --build ./build/x86_64 --config Release
96+
97+
- name: Build SDL_image for arm64-v8a
98+
run: |
99+
cd SDLImage
100+
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release \
101+
-DCMAKE_SYSTEM_NAME=Android \
102+
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME \
103+
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
104+
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
105+
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
106+
-DCMAKE_ANDROID_API=21 \
107+
-DSDL2_INCLUDE_DIR=./SDL2/include \
108+
-DSDL2_LIBRARY=./SDL2/build/arm64-v8a/libSDL2.so \
109+
-S ./ \
110+
-B ./build/arm64-v8a
111+
cmake --build ./build/arm64-v8a --config Release
112+
113+
- name: Build SDL_image for x86_64
114+
run: |
115+
cd SDLImage
116+
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release \
117+
-DCMAKE_SYSTEM_NAME=Android \
118+
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME \
119+
-DCMAKE_ANDROID_ARCH_ABI=x86_64 \
120+
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
121+
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
122+
-DCMAKE_ANDROID_API=21 \
123+
-DSDL2_INCLUDE_DIR=./SDL2/include \
124+
-DSDL2_LIBRARY=./SDL2/build/x86_64/libSDL2.so \
125+
-S ./ \
126+
-B ./build/x86_64
127+
cmake --build ./build/x86_64 --config Release
128+
129+
- name: Upload Artifacts
130+
uses: actions/upload-artifact@v4.3.4
131+
with:
132+
name: ${{ matrix.os }}-${{ matrix.arch }}-artifacts
133+
path: |
134+
SDLImage/build/arm64-v8a/*.so
135+
SDLImage/build/x86_64/*.so
136+
if-no-files-found: ignore # 'warn' or 'ignore' or 'error'

.github/workflows/cmake.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Build SDL2 Image Libraries
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
include:
11+
- os: ubuntu-latest
12+
arch: x86_64
13+
- os: ubuntu-latest
14+
arch: arm64
15+
- os: windows-latest
16+
arch: x86_64
17+
a: x64
18+
arch-cmake: x64
19+
- os: windows-latest
20+
arch: x86
21+
a: x86
22+
arch-cmake: win32
23+
- os: windows-latest
24+
arch: arm64
25+
a: arm64
26+
arch-cmake: arm64
27+
- os: macos-latest
28+
arch: x86_64
29+
- os: macos-latest
30+
arch: arm64
31+
32+
steps:
33+
- uses: actions/checkout@v4.1.7
34+
with:
35+
repository: 'libsdl-org/SDL_image'
36+
path: 'SDLImage'
37+
ref: 'release-2.8.2'
38+
submodules: true
39+
40+
- name: Checkout specific commit
41+
run: |
42+
cd SDLImage
43+
git checkout abcf63a
44+
45+
- name: Install Dependencies on Ubuntu
46+
if: matrix.os == 'ubuntu-latest'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y \
50+
libsdl2-dev \
51+
libpng-dev \
52+
libjpeg-dev \
53+
libtiff-dev \
54+
libwebp-dev
55+
56+
- name: Install Dependencies on macOS
57+
if: matrix.os == 'macos-latest'
58+
run: |
59+
brew install sdl2 libpng jpeg libtiff webp
60+
61+
- name: Install SDL2 on Windows
62+
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64'
63+
shell: pwsh
64+
run: |
65+
cd ./SDLImage/
66+
git clone https://github.com/libsdl-org/SDL.git SDL2
67+
cd SDL2
68+
git checkout tags/release-2.30.6
69+
mkdir build
70+
cd build
71+
cmake .. -A arm64 -DCMAKE_BUILD_TYPE=Release
72+
cmake --build . --config Release
73+
74+
- name: Install SDL2 on Windows
75+
if: matrix.os == 'windows-latest' && matrix.arch != 'arm64'
76+
shell: pwsh
77+
run: |
78+
cd ./SDLImage/
79+
Invoke-WebRequest -Uri https://www.libsdl.org/release/SDL2-devel-2.30.6-VC.zip -OutFile SDL2.zip
80+
Expand-Archive -Path SDL2.zip -DestinationPath SDL2
81+
82+
- name: Configure SDLImage with CMake
83+
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64'
84+
run: |
85+
cd SDLImage
86+
cmake -S ./ -B ./build -DBUILD_SHARED_LIBS=ON -DSDL2IMAGE_SAMPLES=OFF -DSDL2IMAGE_TESTS=OFF -DSDL2_INCLUDE_DIR="./SDL2/include" -DSDL2_LIBRARY="./SDL2/build/Release/SDL2.lib" -A arm64
87+
88+
- name: Configure SDLImage with CMake
89+
if: matrix.os == 'windows-latest' && matrix.arch != 'arm64'
90+
run: |
91+
cd SDLImage
92+
cmake -S ./ -B ./build -DBUILD_SHARED_LIBS=ON -DSDL2IMAGE_SAMPLES=OFF -DSDL2IMAGE_TESTS=OFF -DSDL2_INCLUDE_DIR="./SDL2/SDL2-2.30.6/include" -DSDL2_LIBRARY="./SDL2/SDL2-2.30.6/lib/${{ matrix.a }}/SDL2.lib" -A ${{ matrix.arch-cmake }}
93+
94+
- name: Configure SDLImage with CMake
95+
if: matrix.os != 'windows-latest'
96+
run: |
97+
cd SDLImage
98+
cmake -S ./ -B ./build -DBUILD_SHARED_LIBS=ON -DSDL2IMAGE_SAMPLES=OFF -DSDL2IMAGE_TESTS=OFF
99+
100+
- name: Build SDLImage
101+
run: cmake --build SDLImage/build --config Release
102+
103+
- name: Upload Artifacts
104+
uses: actions/upload-artifact@v4.3.4
105+
with:
106+
name: ${{ matrix.os }}-${{ matrix.arch }}-artifacts
107+
path: |
108+
SDLImage/build/Release/*.dll
109+
SDLImage/build/*.so
110+
SDLImage/build/*.dylib
111+
if-no-files-found: ignore # 'warn' or 'ignore' or 'error'

0 commit comments

Comments
 (0)