summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/modules/AddResources.cmake27
-rw-r--r--kurator/CMakeLists.txt6
-rw-r--r--universe/CMakeLists.txt5
4 files changed, 40 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3a4775..bea1833 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,9 +3,11 @@ project(kurator)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS No)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
find_package(EnTT 3 REQUIRED)
find_package(nlohmann_json 3 REQUIRED)
find_package(raylib 4 REQUIRED)
+include(AddResources)
add_subdirectory(campaign)
add_subdirectory(contrib)
add_subdirectory(kurator)
diff --git a/cmake/modules/AddResources.cmake b/cmake/modules/AddResources.cmake
new file mode 100644
index 0000000..4f4f800
--- /dev/null
+++ b/cmake/modules/AddResources.cmake
@@ -0,0 +1,27 @@
+function(add_resources RESOURCES_TARGET)
+ cmake_parse_arguments(
+ PARSE_ARGV 1
+ RESOURCES
+ ""
+ "PREFIX"
+ "FILES"
+ )
+ if(NOT DEFINED RESOURCES_PREFIX)
+ set(RESOURCES_PREFIX ${CMAKE_BINARY_DIR})
+ endif()
+ foreach(RESOURCES_SOURCE IN ITEMS ${RESOURCES_FILES})
+ add_custom_command(
+ OUTPUT "${RESOURCES_PREFIX}/${RESOURCES_SOURCE}"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCES_SOURCE}"
+ COMMAND
+ ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCES_SOURCE}"
+ "${RESOURCES_PREFIX}/${RESOURCES_SOURCE}"
+ )
+ endforeach()
+ list(TRANSFORM RESOURCES_FILES PREPEND "${RESOURCES_PREFIX}/")
+ add_custom_target(
+ ${RESOURCES_TARGET} ALL
+ DEPENDS ${RESOURCES_FILES}
+ )
+endfunction()
diff --git a/kurator/CMakeLists.txt b/kurator/CMakeLists.txt
index 3a7fedc..2fd6c55 100644
--- a/kurator/CMakeLists.txt
+++ b/kurator/CMakeLists.txt
@@ -27,3 +27,9 @@ target_link_libraries(
PRIVATE stats
PRIVATE universe
)
+add_resources(
+ kurator_resources FILES
+ resources/skybox.png
+ resources/shaders/330/skybox.fs
+ resources/shaders/330/skybox.vs
+)
diff --git a/universe/CMakeLists.txt b/universe/CMakeLists.txt
index 7e8a795..b262854 100644
--- a/universe/CMakeLists.txt
+++ b/universe/CMakeLists.txt
@@ -11,3 +11,8 @@ target_include_directories(
${PROJECT_NAME}
PUBLIC include
)
+add_resources(
+ universe_resources FILES
+ resources/universe/ship_types.json
+ resources/universe/turret_types.json
+)