cmake_minimum_required(VERSION 3.21) project(lightkeeper LANGUAGES CXX C) set(GAME_SRC src/main.cpp src/Lightkeeper.cpp src/scenes/Experiments.cpp src/components/GameComponentRegistry.cpp src/components/Activatable.cpp src/components/Checkpoint.cpp src/components/CrosshairUI.cpp src/components/Door.cpp src/components/FirstPersonController.cpp src/components/Interactable.cpp src/components/InteractableButton.cpp src/components/LightToggle.cpp src/components/MovingPlatform.cpp src/components/PlayerRespawn.cpp src/components/PrintComponent.cpp src/components/TriggerLoggerComponent.cpp src/components/WinGoal.cpp src/components/WinScreenUI.cpp ) add_executable(lightkeeper ${GAME_SRC}) set_target_properties(lightkeeper PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF ) #target_add_extra_warnings(lightkeeper) target_include_directories(lightkeeper PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include") target_link_libraries(lightkeeper PRIVATE destrum::destrum destrum::editor) target_compile_definitions(lightkeeper PRIVATE LIGHTKEEPER_ASSETS_SRC_DIR="${CMAKE_CURRENT_LIST_DIR}/assets_src") #set(ASSETS_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_src") #set(ASSETS_RUNTIME_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_runtime") #set(OUTPUT_GAME_ASSETS_DIR "${CMAKE_BINARY_DIR}/assets/game") # #add_custom_command(TARGET lightkeeper POST_BUILD # COMMAND ${CMAKE_COMMAND} -E make_directory "${OUTPUT_GAME_ASSETS_DIR}" # COMMAND ${CMAKE_COMMAND} -E rm -rf "${OUTPUT_GAME_ASSETS_DIR}" # COMMAND ${CMAKE_COMMAND} -E create_symlink "${ASSETS_RUNTIME_DIR}" "${OUTPUT_GAME_ASSETS_DIR}" # VERBATIM #) set(ASSETS_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_src") set(ASSETS_RUNTIME_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_runtime") set(OUTPUT_GAME_ASSETS_DIR "$/assets/game") if (WIN32) set(GAME_ASSET_INSTALL_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_directory "${ASSETS_RUNTIME_DIR}" "${OUTPUT_GAME_ASSETS_DIR}") else() set(GAME_ASSET_INSTALL_COMMANDS COMMAND ${CMAKE_COMMAND} -E create_symlink "${ASSETS_RUNTIME_DIR}" "${OUTPUT_GAME_ASSETS_DIR}") endif() add_custom_command(TARGET lightkeeper POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${OUTPUT_GAME_ASSETS_DIR}/.." COMMAND ${CMAKE_COMMAND} -E rm -rf "${OUTPUT_GAME_ASSETS_DIR}" ${GAME_ASSET_INSTALL_COMMANDS} VERBATIM ) file(GLOB_RECURSE GAME_ASSET_SOURCES CONFIGURE_DEPENDS "${ASSETS_SRC_DIR}/*") add_custom_target(_internal_clean_game_assets COMMAND TheChef --input "${ASSETS_SRC_DIR}" --output "${ASSETS_RUNTIME_DIR}" --clean DEPENDS TheChef ) add_custom_target(_internal_cook_game_assets COMMAND TheChef --input "${ASSETS_SRC_DIR}" --output "${ASSETS_RUNTIME_DIR}" ${DESTRUM_CHEF_FLAGS} DEPENDS TheChef ${GAME_ASSET_SOURCES} VERBATIM ) add_custom_target(_internal_validate_game_assets COMMAND TheChef --input "${ASSETS_SRC_DIR}" --output "${ASSETS_RUNTIME_DIR}" --validate ${DESTRUM_CHEF_FLAGS} DEPENDS _internal_cook_game_assets VERBATIM ) add_dependencies(lightkeeper _internal_cook_game_assets) destrum_cook_engine_assets(lightkeeper "${CMAKE_CURRENT_BINARY_DIR}") destrum_copy_runtime_dlls(lightkeeper) install(TARGETS lightkeeper RUNTIME DESTINATION bin) install(DIRECTORY "${ASSETS_RUNTIME_DIR}/" DESTINATION "bin/assets/game")