# Copyright (c) 2021 Dominic Msters # # This software is released under the MIT License. # https://opensource.org/licenses/MIT function(tool_assets args) add_custom_target(assets COMMAND tar -C ./assets -cvf assets.zip * DEPENDS ${ARGV} COMMENT "Compressing Assets" ) endfunction() function(tool_copy target) math(EXPR CARGSN "${ARGC} - 1") set(LOOP_DEPENDENCIES) foreach(index RANGE 1 ${CARGSN} 2) math(EXPR indexnext "${index} + 1") set(LOOP_TARGET "item_${target}_${index}") LIST(GET ARGV ${index} from) LIST(GET ARGV ${indexnext} to) LIST(APPEND LOOP_DEPENDENCIES ${LOOP_TARGET}) add_custom_command(OUTPUT ${LOOP_TARGET} COMMAND ${CMAKE_COMMAND} -E copy "${ROOT_DIR}/${ASSETS_DIR}/${from}" "${ASSETS_DIR}/${to}" COMMENT "Copying ${from} => ${to}" ) endforeach() add_custom_target(${target} DEPENDS ${LOOP_DEPENDENCIES} COMMENT "Creating dependency set ${target}" ) endfunction()