isle-portable/android-project/app/build.gradle
2025-08-12 20:29:20 -04:00

67 lines
1.9 KiB
Groovy

plugins {
id 'com.android.application'
}
android {
namespace "org.legoisland.isle"
compileSdk 35
defaultConfig {
applicationId 'org.legoisland.isle'
minSdk 21
targetSdk 35
versionCode 1
versionName '1.0'
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared', "-DFETCHCONTENT_BASE_DIR=${projectDir.parentFile.parentFile}/build/_deps"
if (project.hasProperty('cmakeArgs')) {
project.cmakeArgs.split(" ").each {arg -> arguments arg}
}
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// abiFilters 'x86_64', 'arm64-v8a'
}
}
}
externalNativeBuild {
cmake {
version "3.30.5"
path '../../CMakeLists.txt'
}
}
buildTypes {
release {
minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
prefab true
}
}
tasks.register('downloadSDL3AndroidArchive', Exec) {
def rootDir = projectDir.parentFile.parentFile
def sdl3Dir = "build/_deps/sdl3-src"
def cmakeCommand = "cmake -B build -DANDROID_SDL=TRUE"
def pythonCommand = "python3 ${sdl3Dir}/build-scripts/build-release.py " +
"--actions android " +
"--fast " +
"--force " +
"--root='build/_deps/sdl3-src/'"
def mvCommand = "mv ${sdl3Dir}/build-android/SDL3-*.aar ${projectDir}/libs/SDL3.aar"
commandLine 'sh', '-c', "cd ${rootDir} && ${cmakeCommand} && ${pythonCommand} && mkdir -p ${projectDir}/libs/ && ${mvCommand}"
}
dependencies {
implementation files('libs/SDL3.aar').builtBy(downloadSDL3AndroidArchive)
}