mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Enable Android 16 KB page size support (#22076)
### Description <!-- Describe your changes. --> Add linker flags to support 16KB page size support on Android. See https://source.android.com/docs/core/architecture/16kb-page-size/16kb#build-lib-16kb-alignment ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> #21837
This commit is contained in:
parent
e33b08ead1
commit
99ee6eeca2
1 changed files with 5 additions and 1 deletions
|
|
@ -1,11 +1,15 @@
|
|||
# work around Android NDK bug which doesn't include -O flag for Release configuration
|
||||
# https://github.com/android/ndk/issues/1740
|
||||
# TODO: remove this when the NDK version(s) we support get fixed
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
if (ANDROID)
|
||||
# NB: attempting to match the effects of this fix: https://android-review.googlesource.com/c/platform/ndk/+/2168845
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O3")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O3")
|
||||
string(APPEND CMAKE_ASM_FLAGS_RELEASE " -O3")
|
||||
|
||||
# Build shared libraries with support for 16 KB ELF alignment
|
||||
# https://source.android.com/docs/core/architecture/16kb-page-size/16kb#build-lib-16kb-alignment
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
|
||||
endif()
|
||||
|
||||
# Suggested by https://gitlab.kitware.com/cmake/cmake/-/issues/20132
|
||||
|
|
|
|||
Loading…
Reference in a new issue