From c8cf41c6691cd2bcf661f4ae4e9374ba89edca7f Mon Sep 17 00:00:00 2001 From: Ravbug Date: Sun, 3 Nov 2024 12:39:12 -0500 Subject: [PATCH] Simplify cmake, update NDK --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 21 +++++---------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3b2746..f714b95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index d8e80d8..06a4166 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$) 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 @@ -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") @@ -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)