From 8cf5dc9963211c077b3e274886753e12ebfd5107 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 20 Jun 2023 09:18:19 -0700
Subject: [PATCH] Build on Android targeting the arm64-v8a architecture by
default
This speeds up iteration time and covers most customer devices
---
android-project/app/build.gradle | 13 +++++++------
build-scripts/androidbuildlibs.sh | 15 +++++++++++++--
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle
index baa0edc8de14..f59f482cd0a6 100644
--- a/android-project/app/build.gradle
+++ b/android-project/app/build.gradle
@@ -20,13 +20,14 @@ android {
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16"
- abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+ // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+ abiFilters 'arm64-v8a'
+ }
+ cmake {
+ arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
+ // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+ abiFilters 'arm64-v8a'
}
- // cmake {
- // arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
- // // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
- // abiFilters 'arm64-v8a'
- // }
}
}
buildTypes {
diff --git a/build-scripts/androidbuildlibs.sh b/build-scripts/androidbuildlibs.sh
index 0c715117f516..cd916447b5ab 100755
--- a/build-scripts/androidbuildlibs.sh
+++ b/build-scripts/androidbuildlibs.sh
@@ -29,6 +29,17 @@ obj=
lib=
ndk_args=
+# Allow overriding the ABI from the environment
+if [ "$APP_ABI" = "" ]; then
+ #APP_ABI="armeabi-v7a arm64-v8a x86 x86_64"
+ APP_ABI="arm64-v8a"
+fi
+
+# Allow overriding the platform from the environment
+if [ "$APP_PLATFORM" = "" ]; then
+ APP_PLATFORM=android-16
+fi
+
# Allow an external caller to specify locations.
for arg in $*; do
if [ "${arg:0:8}" == "NDK_OUT=" ]; then
@@ -64,7 +75,7 @@ ndk-build \
NDK_OUT=$obj \
NDK_LIBS_OUT=$lib \
APP_BUILD_SCRIPT=Android.mk \
- APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \
- APP_PLATFORM=android-16 \
+ APP_ABI="$APP_ABI" \
+ APP_PLATFORM="$APP_PLATFORM" \
APP_MODULES="SDL3" \
$ndk_args