From fcbd51f90fcf140b1619701d109c89c9fada1fdb Mon Sep 17 00:00:00 2001 From: Jared Duffey Date: Fri, 1 Sep 2023 13:22:44 -0400 Subject: [PATCH 1/4] Replaced CMAKE_CFG_INTDIR with $ * CMAKE_CFG_INTDIR is deprecated * Fixes packaging with Visual Studio generator * Removed file(MAKE_DIRECTORY) calls that use variables with $ since it can't use generator expressions and the calls aren't required Signed-off-by: Jared Duffey --- CMakeLists.txt | 11 ++--------- cmake/Utility.cmake | 8 ++------ src/Plugins/ComplexCore/CMakeLists.txt | 4 ++-- src/Plugins/ITKImageProcessing/CMakeLists.txt | 4 ++-- src/Plugins/OrientationAnalysis/CMakeLists.txt | 4 ++-- src/Plugins/OrientationAnalysis/test/CMakeLists.txt | 2 +- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbccf30416..8fed8ed980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -808,17 +808,10 @@ set(COMPLEX_PACKAGE_NAMESPACE "complex::") #------------------------------------------------------------------------------ # Install the appropriate example pipelines based on which plugins are loaded #------------------------------------------------------------------------------ -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) -set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/pipelines") -if(NOT EXISTS "${PIPELINE_DEST_DIR}") - file(MAKE_DIRECTORY ${PIPELINE_DEST_DIR}) -endif() - +set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines") set(PIPELINE_EXAMPLES_DEST_DIR "${PIPELINE_DEST_DIR}/Examples") -if(NOT EXISTS "${PIPELINE_EXAMPLES_DEST_DIR}") - file(MAKE_DIRECTORY ${PIPELINE_EXAMPLES_DEST_DIR}) -endif() if(COMPLEX_DOWNLOAD_TEST_FILES AND TARGET ComplexCore AND TARGET ITKImageProcessing AND TARGET OrientationAnalysis) add_custom_target(Copy_PorosityAnalysis_Pipelines ALL diff --git a/cmake/Utility.cmake b/cmake/Utility.cmake index 0a58508c7e..fd7ecafdf4 100644 --- a/cmake/Utility.cmake +++ b/cmake/Utility.cmake @@ -110,8 +110,7 @@ function(download_test_data) # Create the custom CMake File for this archive file #---------------------------------------------------------------------------- set(fetch_data_file "${test_files_dir}/${ARGS_ARCHIVE_NAME}.cmake") - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") - file(MAKE_DIRECTORY "${DATA_DEST_DIR}") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") # Strip off the .tar.gz extension string(REPLACE ".tar.gz" "" ARCHIVE_BASE_NAME "${ARGS_ARCHIVE_NAME}") @@ -126,8 +125,6 @@ function(download_test_data) file(REMOVE "${fetch_data_file}") # Remove the temporary file if(ARGS_COPY_DATA) - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") - configure_file(${complex_SOURCE_DIR}/cmake/CopyDataFile.cmake.in ${fetch_data_file} @ONLY @@ -146,7 +143,6 @@ function(download_test_data) if(ARGS_INSTALL) # If we did NOT already copy the data, then do that now during the build if(NOT ARGS_COPY_DATA) - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") configure_file(${complex_SOURCE_DIR}/cmake/CopyDataFile.cmake.in ${fetch_data_file} @ONLY @@ -183,7 +179,7 @@ function(create_data_copy_rules) endif() - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data/") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data/") if(EXISTS "${ARGS_DREAM3D_DATA_DIR}/Data") add_custom_target(DataFolderCopy ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${ARGS_DREAM3D_DATA_DIR}/Data ${DATA_DEST_DIR} diff --git a/src/Plugins/ComplexCore/CMakeLists.txt b/src/Plugins/ComplexCore/CMakeLists.txt index cec636bfdf..ad26425dc4 100644 --- a/src/Plugins/ComplexCore/CMakeLists.txt +++ b/src/Plugins/ComplexCore/CMakeLists.txt @@ -346,7 +346,7 @@ source_group(TREE "${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}" PREFIX ${PLU # Install example pipelines # ----------------------------------------------------------------------- if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} @@ -369,7 +369,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) diff --git a/src/Plugins/ITKImageProcessing/CMakeLists.txt b/src/Plugins/ITKImageProcessing/CMakeLists.txt index 9919338b92..fd9d1bc89c 100644 --- a/src/Plugins/ITKImageProcessing/CMakeLists.txt +++ b/src/Plugins/ITKImageProcessing/CMakeLists.txt @@ -322,7 +322,7 @@ endif() # Install example pipelines # ----------------------------------------------------------------------- if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} @@ -346,7 +346,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) diff --git a/src/Plugins/OrientationAnalysis/CMakeLists.txt b/src/Plugins/OrientationAnalysis/CMakeLists.txt index aa64f45d68..115818ed7f 100644 --- a/src/Plugins/OrientationAnalysis/CMakeLists.txt +++ b/src/Plugins/OrientationAnalysis/CMakeLists.txt @@ -274,7 +274,7 @@ endif() # Install example pipelines # ----------------------------------------------------------------------- if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} @@ -297,7 +297,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) diff --git a/src/Plugins/OrientationAnalysis/test/CMakeLists.txt b/src/Plugins/OrientationAnalysis/test/CMakeLists.txt index 9d22143da8..954cad85f9 100644 --- a/src/Plugins/OrientationAnalysis/test/CMakeLists.txt +++ b/src/Plugins/OrientationAnalysis/test/CMakeLists.txt @@ -187,7 +187,7 @@ function(add_pipeline_test) if(WIN32) set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/%CONFIG_DIR%/") else() - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/") endif() foreach ( f ${ARGS_DELETE_FILE_LIST}) From b920e529316f55415e2be9d8afd8040a1ef592e2 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sun, 15 Oct 2023 15:05:14 -0400 Subject: [PATCH 2/4] Use $ or "." depending if the generator is multi-config Signed-off-by: Michael Jackson --- CMakeLists.txt | 15 ++++++++-- cmake/CopyDataFile.cmake.in | 5 +++- cmake/Utility.cmake | 7 +++-- src/Plugins/ComplexCore/CMakeLists.txt | 25 +++++++++++++---- src/Plugins/ITKImageProcessing/CMakeLists.txt | 18 ++++++++++-- .../OrientationAnalysis/CMakeLists.txt | 28 ++++++++++++++++--- .../OrientationAnalysis/test/CMakeLists.txt | 10 ++++++- 7 files changed, 90 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fed8ed980..dcc44aee20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -808,15 +808,23 @@ set(COMPLEX_PACKAGE_NAMESPACE "complex::") #------------------------------------------------------------------------------ # Install the appropriate example pipelines based on which plugins are loaded #------------------------------------------------------------------------------ -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + set(CX_CONFIG_DIR "$") +else() + set(CX_CONFIG_DIR ".") +endif() + +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) -set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines") +set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/pipelines") set(PIPELINE_EXAMPLES_DEST_DIR "${PIPELINE_DEST_DIR}/Examples") if(COMPLEX_DOWNLOAD_TEST_FILES AND TARGET ComplexCore AND TARGET ITKImageProcessing AND TARGET OrientationAnalysis) add_custom_target(Copy_PorosityAnalysis_Pipelines ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different "${complex_SOURCE_DIR}/pipelines/PorosityAnalysis.d3dpipeline" "${PIPELINE_EXAMPLES_DEST_DIR}/PorosityAnalysis.d3dpipeline" COMMENT "Copying Example Pipelines into Binary Directory" + COMMAND_EXPAND_LISTS VERBATIM ) set_target_properties(Copy_PorosityAnalysis_Pipelines PROPERTIES FOLDER ZZ_COPY_FILES) @@ -824,6 +832,7 @@ if(COMPLEX_DOWNLOAD_TEST_FILES AND TARGET ComplexCore AND TARGET ITKImageProcess add_custom_target(Copy_CAxis_Pipelines ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different "${complex_SOURCE_DIR}/pipelines/Combo-EBSD-osc_r0c0.d3dpipeline" "${PIPELINE_EXAMPLES_DEST_DIR}/Combo-EBSD-osc_r0c0.d3dpipeline" COMMENT "Copying Example Pipelines into Binary Directory" + COMMAND_EXPAND_LISTS VERBATIM ) set_target_properties(Copy_CAxis_Pipelines PROPERTIES FOLDER ZZ_COPY_FILES) @@ -836,6 +845,8 @@ if(COMPLEX_DOWNLOAD_TEST_FILES AND TARGET ComplexCore AND TARGET ITKImageProcess WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "[DATA EXTRACT/COPY] 6_6_caxis_data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_CAxis_Data PROPERTIES FOLDER ZZ_COPY_FILES) endif() diff --git a/cmake/CopyDataFile.cmake.in b/cmake/CopyDataFile.cmake.in index d6407750ba..c8f0a03132 100644 --- a/cmake/CopyDataFile.cmake.in +++ b/cmake/CopyDataFile.cmake.in @@ -1,4 +1,7 @@ # -------------------------------------------------------------------------------------------------- # message(STATUS "[DATA COPY] Copy data from @ARGS_DREAM3D_DATA_DIR@/TestFiles/@ARCHIVE_BASE_NAME@") # -------------------------------------------------------------------------------------------------- -# execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "@ARGS_DREAM3D_DATA_DIR@/TestFiles/@ARCHIVE_BASE_NAME@" "Data/@ARCHIVE_BASE_NAME@") +# execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "@ARGS_DREAM3D_DATA_DIR@/TestFiles/@ARCHIVE_BASE_NAME@" "Data/@ARCHIVE_BASE_NAME@" +# COMMAND_EXPAND_LISTS +# VERBATIM +# ) diff --git a/cmake/Utility.cmake b/cmake/Utility.cmake index fd7ecafdf4..929f8edbc7 100644 --- a/cmake/Utility.cmake +++ b/cmake/Utility.cmake @@ -110,7 +110,7 @@ function(download_test_data) # Create the custom CMake File for this archive file #---------------------------------------------------------------------------- set(fetch_data_file "${test_files_dir}/${ARGS_ARCHIVE_NAME}.cmake") - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/\${CONFIG}/Data") # Strip off the .tar.gz extension string(REPLACE ".tar.gz" "" ARCHIVE_BASE_NAME "${ARGS_ARCHIVE_NAME}") @@ -183,7 +183,10 @@ function(create_data_copy_rules) if(EXISTS "${ARGS_DREAM3D_DATA_DIR}/Data") add_custom_target(DataFolderCopy ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${ARGS_DREAM3D_DATA_DIR}/Data ${DATA_DEST_DIR} - COMMENT "Copying Data Folder into Binary Directory") + COMMENT "Copying Data Folder into Binary Directory" + COMMAND_EXPAND_LISTS + VERBATIM + ) set_target_properties(DataFolderCopy PROPERTIES FOLDER ZZ_COPY_FILES) set(DREAM3D_DATA_DIRECTORIES diff --git a/src/Plugins/ComplexCore/CMakeLists.txt b/src/Plugins/ComplexCore/CMakeLists.txt index ad26425dc4..962c09532a 100644 --- a/src/Plugins/ComplexCore/CMakeLists.txt +++ b/src/Plugins/ComplexCore/CMakeLists.txt @@ -345,12 +345,23 @@ source_group(TREE "${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}" PREFIX ${PLU # ----------------------------------------------------------------------- # Install example pipelines # ----------------------------------------------------------------------- +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + set(CX_CONFIG_DIR "$") +else() + set(CX_CONFIG_DIR ".") +endif() + + if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} - COMMENT "Copying Pipeline Folder into Binary Directory") + COMMENT "Copying Pipeline Folder into Binary Directory" + COMMAND_EXPAND_LISTS + VERBATIM + ) set_target_properties(Copy_${PLUGIN_NAME}_Pipeline_Folder PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) option(${PLUGIN_NAME}_INSTALL_PIPELINES "Enables install of ${PLUGIN_NAME} pipelines" ON) @@ -369,7 +380,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) @@ -390,11 +401,13 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) ) add_custom_target(Copy_${PLUGIN_NAME}_ASCIIData ALL COMMAND ${CMAKE_COMMAND} -E tar xzf "${DREAM3D_DATA_DIR}/TestFiles/ASCIIData.tar.gz" - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${DREAM3D_DATA_DIR}/TestFiles/ASCIIData" "${DATA_DEST_DIR}/ASCIIData" + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${DREAM3D_DATA_DIR}/TestFiles/ASCIIData" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data/ASCIIData" COMMAND ${CMAKE_COMMAND} -E rm -rf "${DREAM3D_DATA_DIR}/TestFiles/ASCIIData" WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/ASCIIData data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_ASCIIData PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) @@ -406,11 +419,13 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) ) add_custom_target(Copy_${PLUGIN_NAME}_STL_Models ALL COMMAND ${CMAKE_COMMAND} -E tar xzf "${DREAM3D_DATA_DIR}/TestFiles/STL_Models.tar.gz" - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${DREAM3D_DATA_DIR}/TestFiles/STL_Models" "${DATA_DEST_DIR}/STL_Models" + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${DREAM3D_DATA_DIR}/TestFiles/STL_Models" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data/STL_Models" COMMAND ${CMAKE_COMMAND} -E rm -rf "${DREAM3D_DATA_DIR}/TestFiles/STL_Models" WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/STL_Models data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_STL_Models PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) diff --git a/src/Plugins/ITKImageProcessing/CMakeLists.txt b/src/Plugins/ITKImageProcessing/CMakeLists.txt index fd9d1bc89c..957211ed53 100644 --- a/src/Plugins/ITKImageProcessing/CMakeLists.txt +++ b/src/Plugins/ITKImageProcessing/CMakeLists.txt @@ -320,13 +320,21 @@ endif() # ----------------------------------------------------------------------- # Install example pipelines -# ----------------------------------------------------------------------- +# -----------------------------------------------------------------------get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + set(CX_CONFIG_DIR "$") +else() + set(CX_CONFIG_DIR ".") +endif() + if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} COMMENT "Copying Pipeline Folder into Binary Directory" + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_Pipeline_Folder PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) @@ -346,7 +354,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) @@ -376,6 +384,8 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/Porosity_Image data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_Porosity_Image PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) endif() @@ -390,6 +400,8 @@ if(FALSE) add_custom_target(Copy_${PLUGIN_NAME}_Data ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${${PLUGIN_NAME}_SOURCE_DIR}/data ${DATA_DEST_DIR}/${PLUGIN_NAME} COMMENT "Copying ${PLUGIN_NAME} data into Binary Directory" + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_Data PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) diff --git a/src/Plugins/OrientationAnalysis/CMakeLists.txt b/src/Plugins/OrientationAnalysis/CMakeLists.txt index 115818ed7f..9fd9d64369 100644 --- a/src/Plugins/OrientationAnalysis/CMakeLists.txt +++ b/src/Plugins/OrientationAnalysis/CMakeLists.txt @@ -273,12 +273,22 @@ endif() # ----------------------------------------------------------------------- # Install example pipelines # ----------------------------------------------------------------------- +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + set(CX_CONFIG_DIR "$") +else() + set(CX_CONFIG_DIR ".") +endif() + if(EXISTS "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines") - set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/pipelines/${PLUGIN_NAME}") + set(PIPELINE_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/pipelines/${PLUGIN_NAME}") add_custom_target(Copy_${PLUGIN_NAME}_Pipeline_Folder ALL COMMAND ${CMAKE_COMMAND} -E copy_directory "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines" ${PIPELINE_DEST_DIR} - COMMENT "Copying Pipeline Folder into Binary Directory") + COMMENT "Copying Pipeline Folder into Binary Directory" + COMMAND_EXPAND_LISTS + VERBATIM + ) set_target_properties(Copy_${PLUGIN_NAME}_Pipeline_Folder PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) option(${PLUGIN_NAME}_INSTALL_PIPELINES "Enables install of ${PLUGIN_NAME} pipelines" ON) @@ -297,7 +307,7 @@ endif() # Download Example Data Files # ----------------------------------------------------------------------- include(${complex_SOURCE_DIR}/cmake/Utility.cmake) -set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data") +set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") file(TO_CMAKE_PATH "${DREAM3D_DATA_DIR}" DREAM3D_DATA_DIR_NORM) @@ -322,6 +332,8 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/T12-MAI-2010 data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_T12-MAI-2010 PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) @@ -337,6 +349,8 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/Textured_Copper data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_Textured_Copper PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) @@ -351,6 +365,8 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME}/Small_IN100 data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR} @@ -364,6 +380,8 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND COMPLEX_DOWNLOAD_TEST_FILES) WORKING_DIRECTORY "${DREAM3D_DATA_DIR}/TestFiles" COMMENT "Copying ${PLUGIN_NAME} data into Binary Directory" DEPENDS Fetch_Remote_Data_Files # Make sure all remote files are downloaded before trying this + COMMAND_EXPAND_LISTS + VERBATIM ) set_target_properties(Copy_${PLUGIN_NAME}_H5Data PROPERTIES FOLDER ZZ_COPY_FILES) endif() @@ -375,7 +393,9 @@ endif() add_custom_target(Copy_${PLUGIN_NAME}_Data ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${${PLUGIN_NAME}_SOURCE_DIR}/data ${DATA_DEST_DIR}/${PLUGIN_NAME} COMMENT "Copying ${PLUGIN_NAME} data into Binary Directory" - ) + COMMAND_EXPAND_LISTS + VERBATIM +) set_target_properties(Copy_${PLUGIN_NAME}_Data PROPERTIES FOLDER Plugins/${PLUGIN_NAME}) option(${PLUGIN_NAME}_INSTALL_DATA_FILES "Enables install of ${PLUGIN_NAME} data files" ON) diff --git a/src/Plugins/OrientationAnalysis/test/CMakeLists.txt b/src/Plugins/OrientationAnalysis/test/CMakeLists.txt index 954cad85f9..3f74d0e01a 100644 --- a/src/Plugins/OrientationAnalysis/test/CMakeLists.txt +++ b/src/Plugins/OrientationAnalysis/test/CMakeLists.txt @@ -184,10 +184,18 @@ function(add_pipeline_test) set(COMPLEX_CTEST_TEST_DRIVER "${${PLUGIN_NAME}_BINARY_DIR}/PrebuiltPipelineTests/${test}.${TEST_SCRIPT_FILE_EXT}") # message(STATUS "==> ${COMPLEX_CTEST_TEST_DRIVER}") set(DELETE_FILE_COMMANDS "") + + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set(CX_CONFIG_DIR "$") + else() + set(CX_CONFIG_DIR ".") + endif() + if(WIN32) set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/%CONFIG_DIR%/") else() - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/") endif() foreach ( f ${ARGS_DELETE_FILE_LIST}) From 401b96ec02505d8c833c2320f95cd0a305fe3bec Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sun, 15 Oct 2023 15:32:55 -0400 Subject: [PATCH 3/4] Visual Studio fixes --- cmake/Utility.cmake | 8 +++++++- src/Plugins/ITKImageProcessing/CMakeLists.txt | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/Utility.cmake b/cmake/Utility.cmake index 929f8edbc7..6fe71a2b63 100644 --- a/cmake/Utility.cmake +++ b/cmake/Utility.cmake @@ -178,8 +178,14 @@ function(create_data_copy_rules) return() endif() + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set(CX_CONFIG_DIR "$") + else() + set(CX_CONFIG_DIR ".") + endif() - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/Data/") + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data/") if(EXISTS "${ARGS_DREAM3D_DATA_DIR}/Data") add_custom_target(DataFolderCopy ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${ARGS_DREAM3D_DATA_DIR}/Data ${DATA_DEST_DIR} diff --git a/src/Plugins/ITKImageProcessing/CMakeLists.txt b/src/Plugins/ITKImageProcessing/CMakeLists.txt index 957211ed53..d10cccdfe9 100644 --- a/src/Plugins/ITKImageProcessing/CMakeLists.txt +++ b/src/Plugins/ITKImageProcessing/CMakeLists.txt @@ -320,7 +320,8 @@ endif() # ----------------------------------------------------------------------- # Install example pipelines -# -----------------------------------------------------------------------get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +# ----------------------------------------------------------------------- +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(is_multi_config) set(CX_CONFIG_DIR "$") else() From 47454f228598190e2eba8d5c28fb54075f0105da Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Sun, 15 Oct 2023 18:28:50 -0400 Subject: [PATCH 4/4] Single and multiconfig install rule fixes --- CMakeLists.txt | 6 ++++-- cmake/Utility.cmake | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcc44aee20..516ffcd551 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,9 @@ file(WRITE ${FETCH_FILE_PATH} "# ----------------------------------------------- # ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<$:Debug>$<$:Release> # -----------------------------------------------------------------------\n cmake_policy(SET CMP0012 NEW) -cmake_policy(SET CMP0054 NEW)\n") +cmake_policy(SET CMP0054 NEW)\n +message(STATUS \"CMAKE_CONFIG=\${CMAKE_CONFIG}\") +") set(TEST_WORKING_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") if(CMAKE_GENERATOR MATCHES "Visual Studio") @@ -112,7 +114,7 @@ endif() if(COMPLEX_BUILD_TESTS AND COMPLEX_DOWNLOAD_TEST_FILES) add_custom_target(Fetch_Remote_Data_Files ALL - COMMAND "${CMAKE_COMMAND}" -P "${FETCH_FILE_PATH}" + COMMAND "${CMAKE_COMMAND}" -DCMAKE_CONFIG=$ -P "${FETCH_FILE_PATH}" COMMENT "Downloading Test Data Files" # WORKING_DIRECTORY "${TEST_WORKING_DIR}" ) diff --git a/cmake/Utility.cmake b/cmake/Utility.cmake index 6fe71a2b63..ee070a91c0 100644 --- a/cmake/Utility.cmake +++ b/cmake/Utility.cmake @@ -109,8 +109,15 @@ function(download_test_data) #---------------------------------------------------------------------------- # Create the custom CMake File for this archive file #---------------------------------------------------------------------------- + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set(CX_CONFIG_DIR "\${CONFIG}") + else() + set(CX_CONFIG_DIR ".") + endif() + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") + set(fetch_data_file "${test_files_dir}/${ARGS_ARCHIVE_NAME}.cmake") - set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/\${CONFIG}/Data") # Strip off the .tar.gz extension string(REPLACE ".tar.gz" "" ARCHIVE_BASE_NAME "${ARGS_ARCHIVE_NAME}") @@ -152,6 +159,12 @@ function(download_test_data) file(REMOVE "${fetch_data_file}") endif() + if(is_multi_config) + set(CX_CONFIG_DIR "$") + else() + set(CX_CONFIG_DIR ".") + endif() + set(DATA_DEST_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CX_CONFIG_DIR}/Data") install(DIRECTORY "${DATA_DEST_DIR}/${ARCHIVE_BASE_NAME}" DESTINATION Data/