2020-04-15 16:27:40 +02:00
|
|
|
apply plugin: 'com.android.library'
|
2020-05-24 12:55:48 +02:00
|
|
|
apply plugin: 'de.undercouch.download'
|
2020-04-15 16:27:40 +02:00
|
|
|
|
|
|
|
android {
|
2021-10-31 23:32:25 +01:00
|
|
|
ndkVersion "$ndk_version"
|
2020-04-15 16:27:40 +02:00
|
|
|
defaultConfig {
|
2023-02-18 00:03:28 +01:00
|
|
|
minSdkVersion 21
|
2024-08-02 00:13:13 +02:00
|
|
|
compileSdk 34
|
|
|
|
targetSdkVersion 34
|
2020-04-15 16:27:40 +02:00
|
|
|
externalNativeBuild {
|
2023-05-26 15:21:23 +02:00
|
|
|
cmake {
|
|
|
|
arguments "-DANDROID_STL=c++_shared",
|
|
|
|
"-DENABLE_CURL=1", "-DENABLE_SOUND=1",
|
2024-04-21 15:51:58 +02:00
|
|
|
"-DENABLE_GETTEXT=1",
|
2023-05-26 15:21:23 +02:00
|
|
|
"-DBUILD_UNITTESTS=0", "-DENABLE_UPDATE_CHECKER=0"
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
externalNativeBuild {
|
2023-05-26 15:21:23 +02:00
|
|
|
cmake {
|
|
|
|
path file("../../CMakeLists.txt")
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// supported architectures
|
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
enable true
|
|
|
|
reset()
|
2022-08-25 23:48:49 +02:00
|
|
|
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
2021-10-15 18:14:48 +02:00
|
|
|
ndk {
|
2024-05-23 20:36:01 +02:00
|
|
|
debugSymbolLevel 'FULL'
|
2021-10-15 18:14:48 +02:00
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
2024-08-02 00:13:13 +02:00
|
|
|
namespace 'net.minetest'
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
|
2020-05-24 12:55:48 +02:00
|
|
|
// get precompiled deps
|
2024-02-18 14:58:38 +01:00
|
|
|
def depsDir = new File(buildDir.parent, 'deps')
|
|
|
|
if (new File(depsDir, 'armeabi-v7a').exists()) {
|
|
|
|
task getDeps {
|
|
|
|
doLast { logger.lifecycle('Using existing deps from {}', depsDir) }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
task downloadDeps(type: Download) {
|
|
|
|
def depsZip = new File(buildDir, 'deps.zip')
|
2023-02-23 11:32:42 +01:00
|
|
|
|
2024-03-21 20:43:20 +01:00
|
|
|
src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps-lite.zip'
|
2024-02-18 14:58:38 +01:00
|
|
|
dest depsZip
|
|
|
|
overwrite false
|
2020-05-24 12:55:48 +02:00
|
|
|
|
2024-02-18 14:58:38 +01:00
|
|
|
task getDeps(dependsOn: downloadDeps, type: Copy) {
|
|
|
|
depsDir.mkdir()
|
|
|
|
from zipTree(depsZip)
|
|
|
|
into depsDir
|
|
|
|
doFirst { logger.lifecycle('Extracting to {}', depsDir) }
|
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-24 12:55:48 +02:00
|
|
|
preBuild.dependsOn getDeps
|
2023-02-23 11:32:42 +01:00
|
|
|
|
|
|
|
clean {
|
|
|
|
delete new File(buildDir.parent, 'deps')
|
|
|
|
}
|