Browse Source

CMake: Copy assets to the build directory automatically

master
Riyyi 2 years ago
parent
commit
17e3a8a5eb
  1. 7
      CMakeLists.txt
  2. 1
      cmake/copy-assets.cmake
  3. 1
      example/CMakeLists.txt

7
CMakeLists.txt

@ -66,6 +66,13 @@ add_subdirectory("vendor")
# Add engine target to project
add_subdirectory("src")
# ------------------------------------------
# Assets target
add_custom_target(${ENGINE}-assets ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/copy-assets.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# ------------------------------------------
# Examples target

1
cmake/copy-assets.cmake

@ -0,0 +1 @@
file(COPY ${CMAKE_CURRENT_LIST_DIR}/../assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

1
example/CMakeLists.txt

@ -25,4 +25,5 @@ target_precompile_headers(${GAME} REUSE_FROM ${ENGINE})
# Add 'make run' target
add_custom_target(run
COMMAND ${GAME}
WORKING_DIRECTORY ".."
)

Loading…
Cancel
Save