summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorHenrique Alves <henrique.alves@itsjungle.xyz>2024-04-25 22:18:46 +0300
committerHenrique Alves <henrique.alves@itsjungle.xyz>2024-04-25 22:18:46 +0300
commit3f382e6e0a494baaf3d4d104c1af0630fb3817a9 (patch)
treeefcf7806e8bb78654e3af77f735ac3b584e2db14 /CMakeLists.txt
parent97168aaf30c64c688e0057f28f1f2375b4c40520 (diff)
downloadgamejam-slgj-2024-3f382e6e0a494baaf3d4d104c1af0630fb3817a9.tar.gz
gamejam-slgj-2024-3f382e6e0a494baaf3d4d104c1af0630fb3817a9.tar.bz2
gamejam-slgj-2024-3f382e6e0a494baaf3d4d104c1af0630fb3817a9.zip
Add output folder
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b192bf0..bb1e39f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,26 @@ endif()
if (EMSCRIPTEN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s GL_ENABLE_GET_PROC_ADDRESS=1 --embed-file assets --embed-file scripts")
set(CMAKE_EXECUTABLE_SUFFIX ".html") # This line is used to set your executable to build with the emscripten html template so that you can directly open it.
+ add_custom_command(
+ TARGET ${CMAKE_PROJECT_NAME} PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/assets
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/scripts $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/scripts
+ )
+ add_custom_command(
+ TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/scripts ${CMAKE_SOURCE_DIR}/out/scripts
+ COMMAND ${CMAKE_COMMAND} -E copy_directory $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/assets ${CMAKE_SOURCE_DIR}/out/assets
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.html ${CMAKE_SOURCE_DIR}/out/${CMAKE_PROJECT_NAME}.html
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.js ${CMAKE_SOURCE_DIR}/out/${CMAKE_PROJECT_NAME}.js
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.wasm ${CMAKE_SOURCE_DIR}/out/${CMAKE_PROJECT_NAME}.wasm
+ )
+else ()
+ add_custom_command(
+ TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/scripts ${CMAKE_SOURCE_DIR}/out/scripts
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets ${CMAKE_SOURCE_DIR}/out/assets
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/${CMAKE_PROJECT_NAME} ${CMAKE_SOURCE_DIR}/out/${CMAKE_PROJECT_NAME}
+ )
endif ()
# Setting ASSETS_PATH