mirror of https://github.com/libsdl-org/SDL
parent
18206446bf
commit
86f50ae7d7
|
@ -4,11 +4,57 @@ on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
android:
|
android:
|
||||||
|
name: ${{ matrix.platform.name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- { name: Android.mk }
|
||||||
|
- { name: CMake, cmake: '-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DANDROID_PLATFORM=android-23 -DCMAKE_SYSTEM_VERSION=23 ' }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: nttld/setup-ndk@v1
|
- uses: nttld/setup-ndk@v1
|
||||||
|
id: setup_ndk
|
||||||
with:
|
with:
|
||||||
ndk-version: r21e
|
ndk-version: r21e
|
||||||
- name: Build
|
- name: Build (Android.mk)
|
||||||
run: ./build-scripts/androidbuildlibs.sh
|
if: ${{ matrix.platform.name == 'Android.mk' }}
|
||||||
|
run: |
|
||||||
|
./build-scripts/androidbuildlibs.sh
|
||||||
|
- name: Setup (CMake)
|
||||||
|
if: ${{ matrix.platform.name == 'CMake' }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install ninja-build
|
||||||
|
- 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 \
|
||||||
|
${{ matrix.platform.cmake }} \
|
||||||
|
-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 \
|
||||||
|
${{ matrix.platform.cmake }} \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
|
||||||
|
cmake --build cmake_config_build --verbose
|
||||||
|
|
|
@ -15,6 +15,9 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
||||||
set(SDL2_SDL2_FOUND TRUE)
|
set(SDL2_SDL2_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||||
|
if(ANDROID)
|
||||||
|
enable_language(CXX)
|
||||||
|
endif()
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake")
|
||||||
set(SDL2_SDL2-static_FOUND TRUE)
|
set(SDL2_SDL2-static_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -3,6 +3,15 @@
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
project(sdl_test LANGUAGES C)
|
project(sdl_test LANGUAGES C)
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
macro(add_executable NAME)
|
||||||
|
set(args ${ARGN})
|
||||||
|
list(REMOVE_ITEM args WIN32)
|
||||||
|
add_library(${NAME} SHARED ${args})
|
||||||
|
unset(args)
|
||||||
|
endmacro()
|
||||||
|
endif()
|
||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
|
|
||||||
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot
|
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot
|
||||||
|
|
Loading…
Reference in New Issue