Allow specifying APP_PLATFORM and APP_ABI on the command line

This commit is contained in:
Sam Lantinga 2023-06-21 13:49:09 -07:00
parent 214d5daa3c
commit 808d83dd67
1 changed files with 12 additions and 15 deletions

View File

@ -25,30 +25,27 @@ cd $srcdir
build=build
buildandroid=$build/android
platform=android-16
abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64"
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
# Allow an external caller to specify locations and platform.
while [ $# -gt 0 ]; do
arg=$1
if [ "${arg:0:8}" == "NDK_OUT=" ]; then
obj=${arg#NDK_OUT=}
elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then
lib=${arg#NDK_LIBS_OUT=}
elif [ "${arg:0:13}" == "APP_PLATFORM=" ]; then
platform=${arg#APP_PLATFORM=}
elif [ "${arg:0:8}" == "APP_ABI=" ]; then
abi=${arg#APP_ABI=}
else
ndk_args="$ndk_args $arg"
fi
shift
done
if [ -z $obj ]; then
@ -75,7 +72,7 @@ ndk-build \
NDK_OUT=$obj \
NDK_LIBS_OUT=$lib \
APP_BUILD_SCRIPT=Android.mk \
APP_ABI="$APP_ABI" \
APP_PLATFORM="$APP_PLATFORM" \
APP_ABI="$abi" \
APP_PLATFORM="$platform" \
APP_MODULES="SDL3" \
$ndk_args