From 48dcf5cec163d6540edabfe70755f87fed7367ca Mon Sep 17 00:00:00 2001 From: Rami Potinkara Date: Tue, 19 Aug 2025 08:24:32 +0300 Subject: [PATCH] Android: NDK28 and later 16KB page size support for user projects This patch amends 6f3a9c7a6c54010f601870dd31066f3500f6acd0 This amends it by adding linker options to newer NDK's than version 27. NDK 28 and later versions apparently build system shared libraries (.so), like the ones for Qt for Android, with 16KB page sizes by default, but leave Qt user projects to be configured separately by the Qt application author. This patch mitigates the need for Qt application authors to add separate link options into their applications CMakeList.txt. Task-number: QTBUG-131514 Task-number: QTBUG-134093 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Idddeb2bb8c519db7a3ec87eb5e50b9e2030e2815 Reviewed-by: Assam Boudjelthia --- cmake/QtPlatformTargetHelpers.cmake | 2 +- configure.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/QtPlatformTargetHelpers.cmake b/cmake/QtPlatformTargetHelpers.cmake index 4ea305b8b28..33b49960984 100644 --- a/cmake/QtPlatformTargetHelpers.cmake +++ b/cmake/QtPlatformTargetHelpers.cmake @@ -31,7 +31,7 @@ function(qt_internal_setup_public_platform_target) # in order to satisfy linker dependencies. Both of these libraries are part of # the NDK. if (ANDROID) - if(QT_FEATURE_android_16kb_pages AND (CMAKE_ANDROID_NDK_VERSION VERSION_LESS "28.0.0")) + if(QT_FEATURE_android_16kb_pages) target_link_options(Platform INTERFACE "-Wl,-z,max-page-size=16384") endif() target_link_libraries(Platform INTERFACE log) diff --git a/configure.cmake b/configure.cmake index 6f348cf1067..49cb0baaa64 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1544,8 +1544,8 @@ qt_configure_add_report_entry( ) qt_configure_add_report_entry( TYPE NOTE - MESSAGE "Building Qt for Android with 16KB page sizes." - CONDITION QT_FEATURE_android_16kb_pages AND (CMAKE_ANDROID_NDK_VERSION VERSION_LESS "28.0.0") + MESSAGE "Building Qt for Android and user projects with 16KB page sizes." + CONDITION QT_FEATURE_android_16kb_pages ) if(WASM) qt_extra_definition("QT_EMCC_VERSION" "\"${EMCC_VERSION}\"" PUBLIC)