diff --git a/CMakeLists.txt b/CMakeLists.txt index 67595f64..0e30637f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -766,10 +766,50 @@ elseif(WIN32) target_include_directories(phd2 PRIVATE "C:/Program Files (x86)/Visual Leak Detector/include") - # Delayed load for all DLLs below in the original project. Now using delay load only for the necessary stuff - #sbigudrv.dll;ICFilterContainer.dll;TIS_DShowLib09.dll;TIS_UDSHL09_vc9.dll;FCApi.dll;OSPL130RT.dll;DLCWB.dll;cfitsio.dll;CMOSDll.dll;DSCI.dll;inpout32.dll;ShoestringGPUSB_DLL.dll;ShoestringLXUSB_DLL.dll;SXUSB.dll;AsiCamera.dll;%(DelayLoadDLLs) + # copy DLL files into the output directory - copy_dependency_with_config(phd2 PHD_COPY_EXTERNAL_ALL PHD_COPY_EXTERNAL_DBG PHD_COPY_EXTERNAL_REL) + set(_copyfiles_dbg ${PHD_COPY_EXTERNAL_ALL} ${PHD_COPY_EXTERNAL_DBG}) + set(_copyfiles_rel ${PHD_COPY_EXTERNAL_ALL} ${PHD_COPY_EXTERNAL_REL}) + foreach(_file IN LISTS _copyfiles_dbg _copyfiles_rel) + if(NOT EXISTS ${_file}) + message(FATAL_ERROR "Dependency ${_file} does not exist") + endif() + endforeach() + foreach(_config dbg rel) + set(_realpaths_${_config}) + foreach(_file ${_copyfiles_${_config}}) + get_filename_component(_realpath ${_file} REALPATH) + list(APPEND _realpaths_${_config} ${_realpath}) + endforeach() + list(REMOVE_DUPLICATES _realpaths_${_config}) + endforeach() + unset(_file) + unset(_config) + + add_custom_command( + TARGET phd2 + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E + $<$:copy_if_different> + $<$>:true> + ${_realpaths_dbg} + $/. + COMMAND_EXPAND_LISTS VERBATIM + COMMENT "$<$:Copy debug libs to output folder>" + ) + add_custom_command( + TARGET phd2 + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E + $<$:copy_if_different> + $<$>:true> + ${_realpaths_rel} + $/. + COMMAND_EXPAND_LISTS VERBATIM + COMMENT "$<$:Copy release libs to output folder>" + ) + unset(_realpaths_dbg) + unset(_realpaths_rel) ## ######################### ## Unix diff --git a/thirdparty/thirdparty.cmake b/thirdparty/thirdparty.cmake index 130b9a5a..3e439f7a 100644 --- a/thirdparty/thirdparty.cmake +++ b/thirdparty/thirdparty.cmake @@ -93,112 +93,6 @@ if(WIN32) include_directories(${VCPKG_INCLUDE}) endif() -# -# copies the dependency files into the target output directory -# -macro(copy_dependency_with_config target_name dependency_list_all dependency_list_dbg dependency_list_release) - - - set(dependency_list_dbg_with_all ${${dependency_list_dbg}} ${${dependency_list_all}}) - set(dependency_list_dbg_with_all_cleaned) - foreach(_element ${dependency_list_dbg_with_all}) - if(NOT EXISTS ${_element}) - message(FATAL_ERROR "Dependency ${_element} does not exist") - endif() - #message(STATUS "copyX ${_element}") - get_filename_component(_element1 ${_element} REALPATH) - set(dependency_list_dbg_with_all_cleaned ${dependency_list_dbg_with_all_cleaned} ${_element1}) - unset(_element1) - endforeach() - - list(REMOVE_DUPLICATES dependency_list_dbg_with_all_cleaned) - set(dependency_list_dbg_with_all ${dependency_list_dbg_with_all_cleaned}) - unset(dependency_list_dbg_with_all_cleaned) - unset(_element) - - foreach(_element ${dependency_list_dbg_with_all}) - get_filename_component(_element_name ${_element} NAME) - add_custom_command( - TARGET ${target_name} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E - $<$:echo> - $<$:"Copy ${_element_name} to $/."> - $<$>:echo_append> - $<$>:"."> - COMMAND ${CMAKE_COMMAND} -E - $<$:copy_if_different> - $<$:${_element}> - $<$:$/.> - $<$>:echo_append> - $<$>:""> - COMMENT "Copy ${target_name} dependencies into the output folder") - - - - #message(STATUS "copy ${_element_name}") - # add_custom_command( - # TARGET ${target_name} - # PRE_BUILD - # COMMAND ${CMAKE_COMMAND} -E echo Copy ${_element_name} into $/. - - # COMMAND ${CMAKE_COMMAND} -E $<$:copy_if_different>$<$>:echo> ${_element} $/. - # COMMENT "Copy ${target_name} dependencies into the output folder") - - unset(_element_name) - endforeach() - unset(dependency_list_dbg_with_all) - unset(_element) - - - set(dependency_list_release_with_all ${${dependency_list_release}} ${${dependency_list_all}}) - set(dependency_list_release_with_all_cleaned) - foreach(_element ${dependency_list_release_with_all}) - if(NOT EXISTS ${_element}) - message(FATAL_ERROR "Dependency ${_element} does not exist") - endif() - get_filename_component(_element1 ${_element} REALPATH) - set(dependency_list_release_with_all_cleaned ${dependency_list_release_with_all_cleaned} ${_element1}) - unset(_element1) - endforeach() - list(REMOVE_DUPLICATES dependency_list_release_with_all_cleaned) - set(dependency_list_release_with_all ${dependency_list_release_with_all_cleaned}) - unset(dependency_list_release_with_all_cleaned) - unset(_element) - - foreach(_element ${dependency_list_release_with_all}) - get_filename_component(_element_name ${_element} NAME) - add_custom_command( - TARGET ${target_name} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E - $<$:echo> #$<$>:echo> ${_element} $/. - $<$:"Copy ${_element_name} to $/."> - $<$>:echo_append> - $<$>:"."> - COMMAND ${CMAKE_COMMAND} -E - $<$:copy_if_different> - $<$:${_element}> - $<$:$/.> - $<$>:echo_append> - $<$>:""> - COMMENT "Copy ${target_name} dependencies into the output folder") - unset(_element_name) - endforeach() - unset(dependency_list_release_with_all) - unset(_element) - - # we can also use this thing to install external stuff - #install( FILES ${dependency_name_debug} - # DESTINATION bin - # CONFIGURATIONS Debug) - #install( FILES ${dependency_name_non_debug} - # DESTINATION bin - # CONFIGURATIONS Release) - - -endmacro(copy_dependency_with_config) - if(APPLE) find_library(quicktimeFramework QuickTime) find_library(iokitFramework IOKit)