Skip to content

Commit

Permalink
Add android15 16KB page size support (axmolengine#2268)
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 authored Dec 13, 2024
1 parent b31bdb2 commit f8b3f99
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion 1k/build.profiles
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions 1k/platforms.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 2 additions & 0 deletions cmake/Modules/AXBuildHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions core/axmolver.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions core/platform/android/libaxmol/axutils.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit f8b3f99

Please sign in to comment.