Copy editor resources when changed

This commit is contained in:
Jean Pierre Cimalando 2021-04-12 06:15:17 +02:00
parent a838dc3dbd
commit 7a33d3079f
3 changed files with 14 additions and 2 deletions

View file

@ -23,12 +23,20 @@ set(EDITOR_RESOURCES
Themes/Default/theme.xml
PARENT_SCOPE)
function(copy_editor_resources SOURCE_DIR DESTINATION_DIR)
function(copy_editor_resources TARGET SOURCE_DIR DESTINATION_DIR)
set(_deps)
foreach(res ${EDITOR_RESOURCES})
get_filename_component(_dir "${res}" DIRECTORY)
file(MAKE_DIRECTORY "${DESTINATION_DIR}/${_dir}")
file(COPY "${SOURCE_DIR}/${res}" DESTINATION "${DESTINATION_DIR}/${_dir}")
add_custom_command(
OUTPUT "${DESTINATION_DIR}/${res}"
COMMAND "${CMAKE_COMMAND}" "-E" "copy"
"${SOURCE_DIR}/${res}" "${DESTINATION_DIR}/${res}"
DEPENDS "${SOURCE_DIR}/${res}")
list(APPEND _deps "${DESTINATION_DIR}/${res}")
endforeach()
add_custom_target("${TARGET}_editor_resources" DEPENDS ${_deps})
add_dependencies("${TARGET}" "${TARGET}_editor_resources")
endfunction()
set(UI_FILES layout/main.fl layout/about.fl)

View file

@ -106,6 +106,7 @@ if(SFIZZ_LV2_UI)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/Contents/Resources")
copy_editor_resources(
${LV2PLUGIN_PRJ_NAME}_ui
"${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources"
"${PROJECT_BINARY_DIR}/Contents/Resources")
endif()

View file

@ -91,6 +91,7 @@ if(SFIZZ_VST)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources")
copy_editor_resources(
${VSTPLUGIN_PRJ_NAME}
"${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources"
"${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources")
if(WIN32)
@ -228,6 +229,7 @@ elseif(SFIZZ_AU)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Resources")
copy_editor_resources(
${AUPLUGIN_PRJ_NAME}
"${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources"
"${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Resources")
set_target_properties(${AUPLUGIN_PRJ_NAME} PROPERTIES
@ -334,6 +336,7 @@ if(SFIZZ_VST2)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Resources")
copy_editor_resources(
${VST2PLUGIN_PRJ_NAME}
"${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources"
"${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Resources")
set_target_properties(${VST2PLUGIN_PRJ_NAME} PROPERTIES