Build with NDK r22, disable NEON on 32-bit ARM to support more devices

This commit is contained in:
Benau 2021-10-04 18:15:21 +08:00
parent 17329a1b29
commit 75db65d43a
5 changed files with 57 additions and 8 deletions

View File

@ -98,6 +98,11 @@ LOCAL_MODULE := ifaddrs
LOCAL_PATH := .
LOCAL_SRC_FILES := ../lib/ifaddrs/ifaddrs.c
LOCAL_CFLAGS := -I../lib/ifaddrs
# Starting NDK21 it enables NEON by default on 32-bit ARM target
# Disable it to support more phones
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -109,6 +114,9 @@ LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_SRC_FILES := $(wildcard ../lib/angelscript/source/*.S) \
$(wildcard ../lib/angelscript/source/*.cpp)
LOCAL_CFLAGS := -I../lib/angelscript/source/
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -119,6 +127,9 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti
LOCAL_SRC_FILES := $(wildcard ../lib/enet/*.c)
LOCAL_CFLAGS := -I../lib/enet/include/ -DHAS_SOCKLEN_T -DENABLE_IPV6
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -130,6 +141,9 @@ LOCAL_CPP_FEATURES += rtti
LOCAL_SRC_FILES := $(wildcard ../lib/bullet/src/*/*.cpp) \
$(wildcard ../lib/bullet/src/*/*/*.cpp)
LOCAL_CFLAGS := -I../lib/bullet/src/
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -140,6 +154,9 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti
LOCAL_SRC_FILES := $(wildcard ../lib/graphics_utils/mipmap/*.c)
LOCAL_CFLAGS := -I../lib/graphics_utils/mipmap
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -153,6 +170,9 @@ LOCAL_SRC_FILES := $(wildcard ../lib/graphics_engine/src/*.c) \
LOCAL_CFLAGS := -I../lib/graphics_engine/include \
-I../lib/sdl2/include/ \
-I../lib/irrlicht/include/
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -163,6 +183,9 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti
LOCAL_SRC_FILES := $(wildcard ../lib/mcpp/*.c)
LOCAL_CFLAGS := -DMCPP_LIB -DHAVE_CONFIG_H
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -173,6 +196,9 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti
LOCAL_SRC_FILES := $(wildcard ../lib/sheenbidi/Source/*.c)
LOCAL_CFLAGS := -I../lib/sheenbidi/Headers
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -183,6 +209,9 @@ LOCAL_PATH := .
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_SRC_FILES := $(wildcard ../lib/tinygettext/src/*.cpp)
LOCAL_CFLAGS := -I../lib/tinygettext/include -DDISABLE_ICONV
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -204,6 +233,9 @@ LOCAL_CFLAGS := -I../lib/irrlicht/source/Irrlicht/ \
-DANDROID_PACKAGE_CALLBACK_NAME=$(PACKAGE_CALLBACK_NAME)
LOCAL_CPPFLAGS := -std=gnu++0x
LOCAL_STATIC_LIBRARIES := libjpeg png zlib
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -214,6 +246,9 @@ LOCAL_CPPFLAGS += -std=c++11
LOCAL_SRC_FILES := ../lib/sdl2/src/hidapi/android/hid.cpp
LOCAL_LDLIBS := -llog
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@ -265,6 +300,9 @@ LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
LOCAL_SHARED_LIBRARIES := hidapi
LOCAL_STATIC_LIBRARIES := cpufeatures
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@ -315,6 +353,9 @@ LOCAL_STATIC_LIBRARIES := irrlicht bullet enet ifaddrs angelscript mcpp SDL2 \
harfbuzz freetype tinygettext graphics_utils \
graphics_engine
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := false
endif
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
$(call import-module, android/cpufeatures)

View File

@ -13,9 +13,9 @@
To run SuperTuxKart on Android, you need a device that meets following
requirements:
- Android 4.4 or later
- Android 4.1 or later
- Processor compatible with armv7 or x86
- GPU that supports OpenGL ES 3.0
- GPU that supports OpenGL ES 2.0
- 1 GB RAM (STK uses ~150 MB in minimal configuration)
- 300 MB of free space on internal storage
- Touch screen or external keyboard
@ -62,9 +62,10 @@ directory will have following structure:
> src
> ...
You need also Android SDK for android-19 platform (the API for Android 4.4) and
Android NDK. Version r20 is recommended, because it's known that it works
without issues.
You also need Android SDK for android-26 platform or later (SDL2 requirement) and
Android NDK. Version r22 is recommended, because it's known that it works
without issues. r24 or later is not compatible because it removes Android 4.1
support (https://github.com/android/ndk/wiki/Changelog-r23#announcements)
You need to create proper "android-sdk" and "android-ndk" symlinks in the
directory with Android project, so that the compilation script will have access

View File

@ -437,7 +437,7 @@ export ANDROID_HOME="$SDK_PATH"
-Pstorepass="$STK_STOREPASS" \
-Pkeystore="$STK_KEYSTORE" \
-Palias="$STK_ALIAS" \
-Pndk_version="20.1.5948944" \
-Pndk_version="22.1.7171670" \
-Pcompile_arch="$COMPILE_ARCH" \
-Pcpu_core="$CPU_CORE" \
$GRADLE_BUILD_TYPE
@ -448,7 +448,7 @@ if [ "$GRADLE_BUILD_TYPE" = "assembleRelease" ]; then
-Pstorepass="$STK_STOREPASS" \
-Pkeystore="$STK_KEYSTORE" \
-Palias="$STK_ALIAS" \
-Pndk_version="20.1.5948944" \
-Pndk_version="22.1.7171670" \
-Pcompile_arch="$COMPILE_ARCH" \
-Pcpu_core="$CPU_CORE" \
"bundleRelease"

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Tested with NDK 20.1.5948944
# Tested with NDK 22.1.7171670
export DIRNAME=$(realpath "$(dirname "$0")")

View File

@ -14,6 +14,13 @@ SET(CMAKE_CXX_COMPILER "${HOST}-clang++")
set(CMAKE_SYSTEM_PROCESSOR ${ARCH})
# Starting NDK21 it enables NEON by default on 32-bit ARM target
# Disable it to support more devices
if("${ARCH}" STREQUAL "arm")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfpv3-d16")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfpv3-d16")
endif()
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH $ENV{NDK_TOOLCHAIN_PATH})