Skip to content

Commit

Permalink
Android: fix naming of shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravbug committed Feb 14, 2024
1 parent f9b3928 commit 93ce472
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ if (ANDROID)
# The SDL java code is hardcoded to load libmain.so on android, so we need to change EXECUTABLE_NAME
# it must also explicitly be a shared library
set(EXECUTABLE_NAME main)
add_library("${EXECUTABLE_NAME}" SHARED ${SOURCES})
add_library("${EXECUTABLE_NAME}" SHARED)
else()
set(EXECUTABLE_NAME "${PROJECT_NAME}")
add_executable("${EXECUTABLE_NAME}" ${SOURCES})
add_executable("${EXECUTABLE_NAME}")
endif()
target_sources(${EXECUTABLE_NAME} PRIVATE ${SOURCES})

target_link_libraries("${EXECUTABLE_NAME}" PUBLIC "RavEngine" ) # also adds header includes
target_compile_features("${EXECUTABLE_NAME}" PRIVATE cxx_std_20) # require C++20

#target_link_options("${EXECUTABLE_NAME}" PUBLIC "-Wl,--undefined=SDL_main")

# inform engine about your different assets
file(GLOB objects "objects/*.obj" "objects/*.fbx")
file(GLOB textures "textures/*")
Expand All @@ -42,8 +46,10 @@ pack_resources(TARGET "${EXECUTABLE_NAME}"
)

if (ANDROID)
# SDL android is hardcoded to load "libmain.so" with no "d" postfix
set_target_properties(${EXECUTABLE_NAME} PROPERTIES DEBUG_POSTFIX "")
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
DEBUG_POSTFIX "" # SDL android is hardcoded to load "libmain.so" with no "d" postfix
)
#target_link_options(${EXECUTABLE_NAME} PUBLIC "-Wl,--no-gc-sections" "-Wl,--undefined=ignore")
endif()

# fixup macOS / iOS / tvOS bundle
Expand Down

0 comments on commit 93ce472

Please sign in to comment.