Skip to content

Commit 7ebec86

Browse files
committed
android: support Google Play 16 kiB page size requirement
1 parent 9cc5316 commit 7ebec86

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

Android.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ endif
159159

160160
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/include
161161

162+
# https://developer.android.com/guide/practices/page-sizes
163+
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
164+
LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384"
165+
162166
include $(BUILD_SHARED_LIBRARY)
163167

164168
###########################

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ if(SDLMIXER_BUILD_SHARED_LIBS)
262262
target_link_libraries(${sdl3_mixer_target_name} PRIVATE SDL3::SDL3-shared)
263263
endif()
264264
sdl_add_warning_options(${sdl3_mixer_target_name} WARNING_AS_ERROR ${SDLMIXER_WERROR})
265+
sdl_add_platform_link_options(${sdl3_mixer_target_name})
265266
if(WIN32 AND BUILD_SHARED_LIBS)
266267
target_sources(${sdl3_mixer_target_name} PRIVATE
267268
src/version.rc
@@ -1134,6 +1135,7 @@ if(SDLMIXER_SAMPLES)
11341135
target_compile_features(${TARGET} PRIVATE c_std_99)
11351136
endif()
11361137
sdl_add_warning_options(${TARGET} WARNING_AS_ERROR ${SDLMIXER_WERROR})
1138+
sdl_add_platform_link_options(${TARGET})
11371139
sdl_target_link_options_no_undefined(${TARGET})
11381140
target_link_libraries(${TARGET} PRIVATE SDL3::SDL3_test)
11391141
target_link_libraries(${TARGET} PRIVATE SDL3_mixer::${sdl3_mixer_target_name})

cmake/PrivateSdlFunctions.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,13 @@ function(sdl_add_warning_options TARGET)
313313
endif()
314314
endfunction()
315315

316+
function(sdl_add_platform_link_options TARGET)
317+
if(ANDROID)
318+
target_link_options(${TARGET} PRIVATE "-Wl,-z,max-page-size=16384")
319+
target_link_options(${TARGET} PRIVATE "-Wl,-z,common-page-size=16384")
320+
endif()
321+
endfunction()
322+
316323
function(sdl_no_deprecated_errors TARGET)
317324
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
318325
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function(add_sdl_mixer_test_executable TARGET)
1515
$<TARGET_PROPERTY:${sdl3_mixer_target_name},COMPILE_DEFINITIONS>
1616
)
1717
sdl_add_warning_options(${TARGET} WARNING_AS_ERROR ${SDLMIXER_WERROR})
18+
sdl_add_platform_link_options(${TARGET})
1819
target_link_libraries(${TARGET} PRIVATE SDL3_mixer::SDL3_mixer SDL3::SDL3)
1920

2021
if(SDLMIXER_TESTS_INSTALL)

0 commit comments

Comments
 (0)