Skip to content

Commit

Permalink
linux: retrieve page size at build time
Browse files Browse the repository at this point in the history
Fixes RPi 5 16 KB page size. Will not work if cross-compiling however
Issue #1288
  • Loading branch information
flyinghead committed Nov 9, 2023
1 parent 9a60cd7 commit 0f6a92c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion core/stdclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f6a92c

Please # to comment.