forked from libsdl-org/SDL
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (141 loc) · 5.74 KB
/
android.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
name: Build (Android)
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
android:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: "Android.mk", ndk-build: 1 }
- { name: "Gradle", gradle: 1 }
- { name: "CMake", cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" }
- { name: "CMake (lean and mean)", cmake: 1, cppflags: "-DSDL_LEAN_AND_MEAN=1", android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-lean-android-arm64", apk-artifact: "SDL-lean-android-apks-arm64" }
steps:
- uses: actions/checkout@v4
- uses: nttld/setup-ndk@v1
if: ${{ matrix.platform.cmake || matrix.platform.ndk-build }}
id: setup_ndk
with:
local-cache: true
ndk-version: r21e
- name: Build (Android.mk)
if: ${{ matrix.platform.ndk-build }}
run: |
./build-scripts/androidbuildlibs.sh
- uses: actions/setup-java@v4
if: ${{ matrix.platform.cmake || matrix.platform.gradle }}
with:
distribution: 'temurin'
java-version: '17'
- name: Create Gradle project
if: ${{ matrix.platform.gradle }}
run: |
python build-scripts/create-android-project.py \
--output "build" \
--variant copy \
org.libsdl.testspriteminimal \
test/testspriteminimal.c test/icon.h
echo ""
echo "Project contents:"
echo ""
find "build/org.libsdl.testspriteminimal"
- name: Build app (Gradle & ndk-build)
if: ${{ matrix.platform.gradle }}
run: |
cd build/org.libsdl.testspriteminimal
./gradlew -i assembleRelease
- name: Build app (Gradle & CMake)
if: ${{ matrix.platform.gradle }}
run: |
cd build/org.libsdl.testspriteminimal
./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1
# - name: Build library (Gradle)
# if: ${{ matrix.platform.gradle }}
# run: |
# cd build/org.libsdl.testspriteminimal
# ./gradlew -i assembleRelease -PBUILD_AS_LIBRARY=1
- name: Setup (CMake)
if: ${{ matrix.platform.cmake }}
run: |
sudo apt-get update
sudo apt-get install ninja-build pkg-config
- name: Configure (CMake)
if: ${{ matrix.platform.cmake }}
run: |
cmake -S . -B build \
-DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" \
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_CLANG_TIDY=ON \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DSDL_SHARED=ON \
-DSDL_STATIC=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=prefix \
-DCMAKE_BUILD_TYPE=Release \
-GNinja
- name: Build (CMake)
if: ${{ matrix.platform.cmake }}
run: |
cmake --build build --config Release --parallel --verbose
- name: Build test apk's (CMake)
if: ${{ matrix.platform.cmake }}
run: |
cmake --build build --config Release --parallel \
--target \
testaudiorecording-apk \
testautomation-apk \
testcontroller-apk \
testmultiaudio-apk \
testsprite-apk \
--verbose
- name: Install (CMake)
if: ${{ matrix.platform.cmake }}
run: |
cmake --install build --config Release
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
if: ${{ matrix.platform.cmake }}
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
if: ${{ matrix.platform.cmake }}
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
cmake --build cmake_config_build --verbose
- name: Verify sdl3.pc
if: ${{ matrix.platform.cmake }}
run: |
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v4
if: ${{ matrix.platform.cmake }}
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*
- uses: actions/upload-artifact@v4
if: ${{ matrix.platform.cmake }}
with:
if-no-files-found: error
name: ${{ matrix.platform.apk-artifact }}
path: build/test/*.apk