2021-07-11 10:38:33 -06:00
|
|
|
name: Build (Android)
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
android:
|
2022-06-14 22:10:25 -06:00
|
|
|
name: ${{ matrix.platform.name }}
|
2021-07-11 10:38:33 -06:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-14 22:10:25 -06:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
|
|
|
- { name: Android.mk }
|
2022-06-16 08:38:58 -06:00
|
|
|
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
|
2022-06-14 22:10:25 -06:00
|
|
|
|
2021-07-11 10:38:33 -06:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: nttld/setup-ndk@v1
|
2022-06-14 22:10:25 -06:00
|
|
|
id: setup_ndk
|
2021-07-11 10:38:33 -06:00
|
|
|
with:
|
2022-07-23 07:31:35 -06:00
|
|
|
ndk-version: r25
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Build (Android.mk)
|
|
|
|
if: ${{ matrix.platform.name == 'Android.mk' }}
|
|
|
|
run: |
|
|
|
|
./build-scripts/androidbuildlibs.sh
|
|
|
|
- name: Setup (CMake)
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2022-06-16 08:38:58 -06:00
|
|
|
sudo apt-get install ninja-build pkg-config
|
2022-06-14 22:10:25 -06:00
|
|
|
- name: Configure (CMake)
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
cmake -B build \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
|
2022-06-16 08:38:58 -06:00
|
|
|
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
|
|
|
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DSDL_STATIC_PIC=ON \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=prefix \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-GNinja
|
|
|
|
- name: Build (CMake)
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
cmake --build build --config Release --parallel --verbose
|
|
|
|
- name: Install (CMake)
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
cmake --install build --config Release
|
|
|
|
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
|
|
|
|
( cd prefix; find ) | LC_ALL=C sort -u
|
|
|
|
- name: Verify CMake configuration files
|
|
|
|
if: ${{ matrix.platform.name == '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 \
|
2022-06-16 08:38:58 -06:00
|
|
|
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
|
|
|
|
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
|
2022-06-14 22:10:25 -06:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
|
|
|
|
cmake --build cmake_config_build --verbose
|
2022-06-16 08:38:58 -06:00
|
|
|
- name: Verify sdl2-config
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
|
|
|
|
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
|
|
|
cmake/test/test_sdlconfig.sh
|
|
|
|
- name: Verify sdl2.pc
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
|
|
|
|
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
|
|
|
cmake/test/test_pkgconfig.sh
|
|
|
|
- name: Verify Android.mk
|
|
|
|
if: ${{ matrix.platform.name == 'CMake' }}
|
|
|
|
run: |
|
|
|
|
export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules
|
|
|
|
ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1
|