linux: retrieve page size at build time

Fixes RPi 5 16 KB page size. Will not work if cross-compiling however
Issue #1288
This commit is contained in:
Flyinghead 2023-11-09 19:29:00 +01:00
parent 9a60cd7ded
commit 0f6a92caad
2 changed files with 6 additions and 1 deletions

View File

@ -235,6 +235,11 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
$<$<BOOL:${WINDOWS_STORE}>:NOCRYPT>
$<$<OR:$<BOOL:${MINGW}>,$<BOOL:${MSVC}>>:_USE_MATH_DEFINES>)
if(UNIX AND NOT ANDROID AND NOT APPLE)
execute_process(COMMAND getconf PAGESIZE OUTPUT_VARIABLE PAGE_SIZE OUTPUT_STRIP_TRAILING_WHITESPACE)
target_compile_definitions(${PROJECT_NAME} PRIVATE PAGE_SIZE=${PAGE_SIZE})
endif()
if(NOT "${SENTRY_UPLOAD_URL}" STREQUAL "")
target_compile_definitions(${PROJECT_NAME} PRIVATE SENTRY_UPLOAD="${SENTRY_UPLOAD_URL}")
endif()

View File

@ -15,7 +15,7 @@
#undef PAGE_MASK
#elif defined(__APPLE__) && defined(__aarch64__)
#define PAGE_SIZE 16384
#else
#elif !defined(PAGE_SIZE)
#define PAGE_SIZE 4096
#endif
#ifndef PAGE_MASK