From f8b3f99e70409d01045b8481ddc2281ebfb18c48 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 14 Dec 2024 03:07:13 +0800 Subject: [PATCH] Add android15 16KB page size support (#2268) --- 1k/build.profiles | 8 +++++++- 1k/platforms.cmake | 5 +++++ 3rdparty/CMakeLists.txt | 1 + cmake/Modules/AXBuildHelpers.cmake | 2 ++ core/axmolver.h.in | 4 ++-- core/platform/android/libaxmol/axutils.gradle | 1 + 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/1k/build.profiles b/1k/build.profiles index 88e46aeb666e..363fb959c010 100644 --- a/1k/build.profiles +++ b/1k/build.profiles @@ -35,7 +35,13 @@ jdk=17.0.10~17.0.13+ # The android ndk version # as stable as possible @setup.ps1 @gradle @axmol-cmdline -ndk=r23c +# for android 15 16KB page size support, ndk-r23d only available on ci.android.com, refer: +# - https://developer.android.com/about/versions/15/behavior-changes-all#16-kb +# - https://developer.android.google.cn/about/versions/15/behavior-changes-all?hl=zh-cn#16-kb +# Android 15 16KB page size only supported by ndk r23 r25 from ci.android.com or r27+ +# In China Mainland, please download from https://pan.baidu.com/s/1neJydxOGTT7aCQvLLwbicw?pwd=qqiq +# to $AX_ROOT/tools/external/, then run `setup.ps1 -p android` +ndk=r23d # The android target sdk version, @gradle # as latest as possible diff --git a/1k/platforms.cmake b/1k/platforms.cmake index b23239a3d4d9..f290e5a163ed 100644 --- a/1k/platforms.cmake +++ b/1k/platforms.cmake @@ -32,6 +32,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android") set(PLATFORM_NAME android) set(ARCH_ALIAS ${ANDROID_ABI}) + + # refer + # - https://developer.android.com/about/versions/15/behavior-changes-all#16-kb + # - https://developer.android.google.cn/about/versions/15/behavior-changes-all?hl=zh-cn#16-kb + set(_16KPAGE_SIZE_LD_FLAGS "-Wl,-z,max-page-size=16384") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LINUX TRUE) set(PLATFORM_NAME linux) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index dda1029e22ad..375c0d2e5a32 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -405,6 +405,7 @@ if (AX_ENABLE_AUDIO) target_compile_definitions(3rdparty INTERFACE AL_LIBTYPE_STATIC=1) elseif(ANDROID) set(ANDROID_SHARED_LOADS "${ANDROID_SHARED_LOADS}System.loadLibrary(\"openal\");" CACHE INTERNAL "Android Shared Loads" ) + target_link_options(OpenAL PRIVATE "${_16KPAGE_SIZE_LD_FLAGS}") endif() endif() diff --git a/cmake/Modules/AXBuildHelpers.cmake b/cmake/Modules/AXBuildHelpers.cmake index 57640b99d7e4..4904d42528e8 100644 --- a/cmake/Modules/AXBuildHelpers.cmake +++ b/cmake/Modules/AXBuildHelpers.cmake @@ -455,6 +455,8 @@ function(ax_setup_app_config app_name) if (_win32_console_app) set_source_files_properties(proj.win32/main.cpp PROPERTIES COMPILE_DEFINITIONS _CONSOLE=1) endif() + elseif(ANDROID) + target_link_options(${APP_NAME} PRIVATE "${_16KPAGE_SIZE_LD_FLAGS}") endif() # auto mark code files for IDE when mark app if(XCODE OR VS) diff --git a/core/axmolver.h.in b/core/axmolver.h.in index 686c1154f89a..ac498ec58fae 100644 --- a/core/axmolver.h.in +++ b/core/axmolver.h.in @@ -4,8 +4,8 @@ // 0x00 HI ME LO // 00 03 08 00 #define AX_VERSION_MAJOR 2 -#define AX_VERSION_MINOR 2 -#define AX_VERSION_PATCH 1 +#define AX_VERSION_MINOR 3 +#define AX_VERSION_PATCH 0 /* Define axmol version helper macros */ #define AX_VERSION_MAKE(a, b, c) ((a << 16) | (b << 8) | (c & 0xff)) diff --git a/core/platform/android/libaxmol/axutils.gradle b/core/platform/android/libaxmol/axutils.gradle index 3e8ee70b03e1..7063cd793ac0 100644 --- a/core/platform/android/libaxmol/axutils.gradle +++ b/core/platform/android/libaxmol/axutils.gradle @@ -354,6 +354,7 @@ class AxmolUtils { options.add('"-DANDROID_STL=c++_shared"') options.add('"-DANDROID_TOOLCHAIN=clang"') options.add('"-DANDROID_ARM_NEON=TRUE"') + options.add('"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"') options.add("\"-D_AX_ANDROID_PROJECT_DIR=${androidProjDir}\"") buildProfiles['cmakeOptions'] = options.toString() }