diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f9378d..71f4c6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ else () endif () include(add_shader.cmake) +include(add_resource_dir.cmake) add_subdirectory("aster") add_subdirectory("samples") diff --git a/add_resource_dir.cmake b/add_resource_dir.cmake new file mode 100644 index 0000000..e414108 --- /dev/null +++ b/add_resource_dir.cmake @@ -0,0 +1,7 @@ +function(add_resource_dir TARGET DIR) + add_custom_command( + TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/ + ${CMAKE_CURRENT_BINARY_DIR}/${DIR}/) +endfunction(add_resource_dir) \ No newline at end of file diff --git a/samples/02_box/CMakeLists.txt b/samples/02_box/CMakeLists.txt index 18d09c9..e3195e9 100644 --- a/samples/02_box/CMakeLists.txt +++ b/samples/02_box/CMakeLists.txt @@ -11,6 +11,4 @@ add_shader(box shader/box.frag.glsl) target_link_libraries(box PRIVATE aster_core) target_link_libraries(box PRIVATE util_helper) -add_custom_target(copy-resource-files ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/image/ ${CMAKE_CURRENT_BINARY_DIR}/ - DEPENDS box) \ No newline at end of file +add_resource_dir(box image) \ No newline at end of file