diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1f52b..7395779 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.23) +cmake_minimum_required(VERSION 3.21) # make "install" write to the build directory set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}) @@ -9,13 +9,20 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$) PROJECT(HelloCube) -add_subdirectory("RavEngine") # configure the engine library +add_subdirectory("RavEngine" EXCLUDE_FROM_ALL) # configure the engine library # configure your executable like normal file(GLOB SOURCES "*.cpp" "*.hpp" "*.h") -add_executable("${PROJECT_NAME}" ${SOURCES}) -target_link_libraries("${PROJECT_NAME}" PUBLIC "RavEngine" ) # also adds header includes -target_compile_features("${PROJECT_NAME}" PRIVATE cxx_std_20) # require C++20 +if (ANDROID) + # The SDL java code is hardcoded to load libmain.so on android, so we need to change EXECUTABLE_NAME + set(EXECUTABLE_NAME main) + add_library("${EXECUTABLE_NAME}" ${SOURCES}) +else() + set(EXECUTABLE_NAME "${PROJECT_NAME}") + add_executable("${EXECUTABLE_NAME}" ${SOURCES}) +endif() +target_link_libraries("${EXECUTABLE_NAME}" PUBLIC "RavEngine" ) # also adds header includes +target_compile_features("${EXECUTABLE_NAME}" PRIVATE cxx_std_20) # require C++20 # inform engine about your different assets file(GLOB objects "objects/*.obj" "objects/*.fbx") @@ -24,7 +31,7 @@ file(GLOB shaders "shaders/*.cmake") file(GLOB fonts "fonts/*.ttf") file(GLOB sounds "sounds/*.ogg") file(GLOB uis "${sample_dir}/ui/*.rml" "${sample_dir}/uis/*.rcss") -pack_resources(TARGET "${PROJECT_NAME}" +pack_resources(TARGET "${EXECUTABLE_NAME}" OBJECTS ${objects} SHADERS ${shaders} TEXTURES ${textures} @@ -38,7 +45,7 @@ pack_resources(TARGET "${PROJECT_NAME}" if(APPLE) INSTALL(CODE "include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/$/${PROJECT_NAME}.app\" \"\" \"\") + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/$/${EXECUTABLE_NAME}.app\" \"\" \"\") " COMPONENT Runtime ) diff --git a/RavEngine b/RavEngine index 1871ef8..f254569 160000 --- a/RavEngine +++ b/RavEngine @@ -1 +1 @@ -Subproject commit 1871ef8dcc8c62c91b89f68b937ac55984e3bd92 +Subproject commit f254569662eb174c5d2b036c6a0ce3f08373b4a3