Skip to content

Commit

Permalink
Simplify cmake, update NDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravbug committed Nov 3, 2024
1 parent 94d07b8 commit c8cf41c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r27
ndk-version: r28
- name: Fix CMake min required
run: |
cd sdl-android-builder/to-build/HelloCube/RavEngine
Expand Down
21 changes: 5 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIGURATION>)

PROJECT(HelloCube)

if (ANDROID)
# On android these flags get added to the NDK which causes SDL_main to get deleted from the .so
string(REPLACE "-Wl,--gc-sections" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
endif()

add_subdirectory("RavEngine" EXCLUDE_FROM_ALL) # configure the engine library

# configure your executable like normal
Expand All @@ -27,13 +21,15 @@ if (ANDROID)
else()
set(EXECUTABLE_NAME "${PROJECT_NAME}")
add_executable("${EXECUTABLE_NAME}")

set_target_properties(${EXECUTABLE_NAME} PROPERTIES
DEBUG_POSTFIX "" # SDL android is hardcoded to load "libmain.so" with no "d" postfix
)
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")
target_compile_features("${EXECUTABLE_NAME}" PRIVATE cxx_std_23) # C++ version

# inform engine about your different assets
file(GLOB objects "objects/*.obj" "objects/*.fbx")
Expand All @@ -51,13 +47,6 @@ pack_resources(TARGET "${EXECUTABLE_NAME}"
SOUNDS ${sounds}
)

if (ANDROID)
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
# this is important if you use third party libraries that are linked dynamically.
if(APPLE)
Expand Down

0 comments on commit c8cf41c

Please sign in to comment.