Skip to content

Commit

Permalink
[build][CMake] Fix cmake configuration issue for Android (#4671)
Browse files Browse the repository at this point in the history
* fix cmake configuration issue for Android

* review comment
  • Loading branch information
Bigfoot71 authored Jan 10, 2025
1 parent b554b53 commit eee86dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/LibraryConfigurations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ elseif (${PLATFORM} MATCHES "Android")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND raylib_sources ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)

# NOTE: We remove '-Wl,--no-undefined' (set by default) as it conflicts with '-Wl,-undefined,dynamic_lookup' needed
# for compiling with the missing 'void main(void)' declaration in `android_main()`.
# We also remove other unnecessary or problematic flags.

string(REPLACE "-Wl,--no-undefined -Qunused-arguments" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-static-libstdc++" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")

find_library(OPENGL_LIBRARY OpenGL)
Expand Down

0 comments on commit eee86dd

Please sign in to comment.