cmake script & ci cleanup

use a cmake script to downoad SDL3 sources for aar building
This commit is contained in:
Kylie C 2025-08-11 21:33:21 -04:00
parent 52fb0063c3
commit 68b6f20ff3
4 changed files with 23 additions and 20 deletions

View File

@ -48,7 +48,6 @@ jobs:
- { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' }
- { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true}
- { name: 'Android', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, android: true, werror: true, clang-tidy: false,}
- { name: 'Android (Debug)', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, android: true, werror: true, clang-tidy: false, debug: true }
steps:
- name: Setup vcvars
if: ${{ !!matrix.msvc }}
@ -83,7 +82,7 @@ jobs:
chmod a+x /opt/devkitpro/tools/bin/makerom
- name: Install Linux dependencies (apt-get)
if: ${{ matrix.linux || matrix.android }}
if: ${{ matrix.linux }}
run: |
sudo apt-get update
sudo apt-get install -y \
@ -124,14 +123,14 @@ jobs:
if: ${{ matrix.android }}
run: |
cd android-project && \
./gradlew assemble${{ matrix.debug == 'true' && 'Debug' || 'Release' }} \
./gradlew assembleRelease \
--info \
-PcmakeArgs="-DCMAKE_BUILD_TYPE=Release
-DISLE_USE_DX5=${{ !!matrix.dx5 }} \
-DISLE_BUILD_CONFIG=${{ !!matrix.config }} \
-DENABLE_CLANG_TIDY=${{ !!matrix.clang-tidy }} \
-DISLE_WERROR=${{ !!matrix.werror }} \
-DISLE_DEBUG=${{ matrix.debug || 'OFF' }} \
-DISLE_DEBUG=OFF \
-Werror=dev"
- name: Configure (CMake)
@ -205,10 +204,8 @@ jobs:
- name: Package (Android)
if: ${{ matrix.android }}
run: |
cd build
mkdir -p dist
find ../ -name '*.apk'
mv ../android-project/app/build/outputs/apk/*/*.apk dist/
mkdir -p build/dist
mv android-project/app/build/outputs/apk/*/*.apk build/dist/
- name: Package Assets Separately
if: matrix.build-assets

View File

@ -55,7 +55,6 @@ cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROS
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON)
option(ANDROID_SDL "Download SDL for Android Archive" OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll")
set(ISLE_EMSCRIPTEN_HOST "" CACHE STRING "Host URL for Emscripten streaming (e.g., https://test.com)")
cmake_dependent_option(BUILD_SHARED_LIBS "Build lego1 as a shared library" ON "NOT EMSCRIPTEN" OFF)
@ -68,9 +67,7 @@ message(STATUS "Isle extensions: ${ISLE_EXTENSIONS}")
message(STATUS "Isle debugging: ${ISLE_DEBUG}")
message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}")
if (NOT ANDROID_SDL)
add_library(Isle::iniparser INTERFACE IMPORTED)
endif()
add_library(Isle::iniparser INTERFACE IMPORTED)
if (DOWNLOAD_DEPENDENCIES)
# FetchContent downloads and configures dependencies
@ -93,10 +90,6 @@ if (DOWNLOAD_DEPENDENCIES)
endif()
FetchContent_MakeAvailable(SDL3)
if (ANDROID_SDL)
return()
endif()
FetchContent_Declare(
iniparser
GIT_REPOSITORY "https://gitlab.com/iniparser/iniparser.git"

View File

@ -15,7 +15,7 @@ android {
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared', "-DFETCHCONTENT_BASE_DIR=${projectDir.parentFile.parentFile}/build/_deps"
arguments '-DANDROID_STL=c++_shared', "-DFETCHCONTENT_BASE_DIR=${projectDir.parentFile}/build/_deps"
if (project.hasProperty('cmakeArgs')) {
project.cmakeArgs.split(" ").each {arg -> arguments arg}
}
@ -48,9 +48,9 @@ android {
}
tasks.register('compileSDL3AndroidArchive', Exec) {
def rootDir = projectDir.parentFile.parentFile
def rootDir = projectDir.parentFile
def sdl3Dir = "build/_deps/sdl3-src"
def cmakeCommand = "cmake -B build -DANDROID_SDL=TRUE"
def cmakeCommand = "cmake -P downloadSDL3.cmake"
def pythonCommand = "python3 ${sdl3Dir}/build-scripts/build-release.py " +
"--actions android " +
"--fast " +
@ -62,5 +62,5 @@ tasks.register('compileSDL3AndroidArchive', Exec) {
}
dependencies {
implementation files('libs/SDL3.aar').builtBy(downloadSDL3AndroidArchive)
implementation files('libs/SDL3.aar').builtBy(compileSDL3AndroidArchive)
}

View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR "build/_deps")
FetchContent_Populate(
SDL3
GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git"
GIT_TAG "main"
SOURCE_DIR "build/_deps/sdl3-src"
BINARY_DIR "build/_deps/sdl3-build"
)