diff --git a/BlueBerry/CMake/MacroCreateCTKPlugin.cmake b/BlueBerry/CMake/MacroCreateCTKPlugin.cmake index f8a62cf04c..8cf7d8d7c7 100644 --- a/BlueBerry/CMake/MacroCreateCTKPlugin.cmake +++ b/BlueBerry/CMake/MacroCreateCTKPlugin.cmake @@ -1,126 +1,126 @@ # MACRO_CREATE_CTK_PLUGIN() # # Creates a CTK plugin. # This macro should be called from the plugins CMakeLists.txt file. # The target name is available after the macro call as ${PROJECT_NAME} # to add additional libraries in your CMakeLists.txt. Include paths and link # libraries are set depending on the value of the Required-Plugins header # in your manifest_headers.cmake file. # MACRO(MACRO_CREATE_CTK_PLUGIN) MACRO_PARSE_ARGUMENTS(_PLUGIN "EXPORT_DIRECTIVE;EXPORTED_INCLUDE_SUFFIXES" "TEST_PLUGIN" ${ARGN}) MESSAGE(STATUS "Creating CTK plugin ${PROJECT_NAME}") SET(PLUGIN_TARGET ${PROJECT_NAME}) INCLUDE(files.cmake) SET(_PLUGIN_CPP_FILES ${CPP_FILES}) SET(_PLUGIN_MOC_H_FILES ${MOC_H_FILES}) SET(_PLUGIN_UI_FILES ${UI_FILES}) SET(_PLUGIN_CACHED_RESOURCE_FILES ${CACHED_RESOURCE_FILES}) SET(_PLUGIN_TRANSLATION_FILES ${TRANSLATION_FILES}) SET(_PLUGIN_QRC_FILES ${QRC_FILES}) SET(_PLUGIN_H_FILES ${H_FILES}) SET(_PLUGIN_TXX_FILES ${TXX_FILES}) SET(_PLUGIN_DOX_FILES ${DOX_FILES}) SET(_PLUGIN_CMAKE_FILES ${CMAKE_FILES} files.cmake) SET(_PLUGIN_FILE_DEPENDENCIES ${FILE_DEPENDENCIES}) IF(CTK_PLUGINS_OUTPUT_DIR) SET(_output_dir "${CTK_PLUGINS_OUTPUT_DIR}") ELSE() SET(_output_dir plugins) ENDIF() IF(_PLUGIN_TEST_PLUGIN) SET(is_test_plugin "TEST_PLUGIN") ELSE() SET(is_test_plugin) ENDIF() #------------------------------------------------------------# #------------------ Qt Help support -------------------------# SET(PLUGIN_GENERATED_QCH_FILES ) IF (BLUEBERRY_USE_QT_HELP AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual") SET(PLUGIN_DOXYGEN_INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual") SET(PLUGIN_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/documentation/UserManual") _FUNCTION_CREATE_CTK_QT_COMPRESSED_HELP(PLUGIN_GENERATED_QCH_FILES ) LIST(APPEND _PLUGIN_CACHED_RESOURCE_FILES ${PLUGIN_GENERATED_QCH_FILES}) ENDIF() # Compute the plugin dependencies ctkFunctionGetTargetLibraries(_PLUGIN_target_libraries) ctkMacroBuildPlugin( NAME ${PLUGIN_TARGET} EXPORT_DIRECTIVE ${_PLUGIN_EXPORT_DIRECTIVE} SRCS ${_PLUGIN_CPP_FILES} MOC_SRCS ${_PLUGIN_MOC_H_FILES} UI_FORMS ${_PLUGIN_UI_FILES} EXPORTED_INCLUDE_SUFFIXES ${_PLUGIN_EXPORTED_INCLUDE_SUFFIXES} RESOURCES ${_PLUGIN_QRC_FILES} TARGET_LIBRARIES ${_PLUGIN_target_libraries} CACHED_RESOURCEFILES ${_PLUGIN_CACHED_RESOURCE_FILES} TRANSLATIONS ${_PLUGIN_TRANSLATION_FILES} OUTPUT_DIR ${_output_dir} ${is_test_plugin} ) IF(mbilog_FOUND) TARGET_LINK_LIBRARIES(${PLUGIN_TARGET} mbilog) ENDIF() INCLUDE_DIRECTORIES(${Poco_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(${PLUGIN_TARGET} optimized PocoFoundation debug PocoFoundationd optimized PocoUtil debug PocoUtild optimized PocoXML debug PocoXMLd ) SET(_PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake") IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml") LIST(APPEND _PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml") ENDIF() MACRO_ORGANIZE_SOURCES( SOURCE ${_PLUGIN_CPP_FILES} HEADER ${_PLUGIN_H_FILES} TXX ${_PLUGIN_TXX_FILES} DOC ${_PLUGIN_DOX_FILES} UI ${_PLUGIN_UI_FILES} QRC ${_PLUGIN_QRC_FILES} ${_PLUGIN_CACHED_RESOURCE_FILES} META ${_PLUGIN_META_FILES} MOC ${MY_MOC_CPP} GEN_UI ${MY_UI_CPP} GEN_QRC ${MY_QRC_SRCS} ) #------------------------------------------------------------# #------------------ Installer support -----------------------# IF(NOT _PLUGIN_TEST_PLUGIN) SET(install_directories "") IF(NOT MACOSX_BUNDLE_NAMES) SET(install_directories bin) ELSE(NOT MACOSX_BUNDLE_NAMES) FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES}) LIST(APPEND install_directories ${bundle_name}.app/Contents/MacOS) ENDFOREACH(bundle_name) ENDIF(NOT MACOSX_BUNDLE_NAMES) FOREACH(install_subdir ${install_directories}) MACRO_INSTALL_CTK_PLUGIN(TARGETS ${PLUGIN_TARGET} - DESTINATION ctk_plugins) + DESTINATION bin/plugins) ENDFOREACH() ENDIF() ENDMACRO() diff --git a/BlueBerry/CMake/MacroInstallPlugin.cmake b/BlueBerry/CMake/MacroInstallPlugin.cmake index 4a2b84b372..43c7d4f5a8 100644 --- a/BlueBerry/CMake/MacroInstallPlugin.cmake +++ b/BlueBerry/CMake/MacroInstallPlugin.cmake @@ -1,77 +1,84 @@ # Install the given plug-in directory to the desintation directory # # MACRO_INSTALL_PLUGIN(plugindir [TARGETS target...] [DESTINATION dest_dir]) # MACRO(MACRO_INSTALL_PLUGIN _plugin_dir) MACRO_PARSE_ARGUMENTS(_INSTALL "TARGETS;DESTINATION" "" ${ARGN}) # Convert _plugin_dir into an absolute path IF(NOT IS_ABSOLUTE _plugin_dir) SET(_plugin_dir "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_dir}") ENDIF() # Check if target names have been specified IF(NOT _INSTALL_TARGETS) - # no targets specified. get the main target from the plug-ins manifest - MACRO_PARSE_MANIFEST("${_plugin_dir}/META-INF/MANIFEST.MF") - STRING(REPLACE "." "_" _INSTALL_TARGETS ${BUNDLE-SYMBOLICNAME}) + # no targets specified. get the main target from the plug-ins manifest if it exists + IF(EXISTS "${_plugin_dir}/META-INF/MANIFEST.MF") + MACRO_PARSE_MANIFEST("${_plugin_dir}/META-INF/MANIFEST.MF") + STRING(REPLACE "." "_" _INSTALL_TARGETS ${BUNDLE-SYMBOLICNAME}) + ENDIF() ENDIF() + # Only continue if _INSTALL_TARGETS is set + IF(_INSTALL_TARGETS) + IF(NOT _INSTALL_DESTINATION) SET(_INSTALL_DESTINATION "bin/") ELSE() SET(_INSTALL_DESTINATION "${_INSTALL_DESTINATION}/") ENDIF() STRING(REGEX REPLACE ".*/(.+)/?$" "\\1" _toplevel_plugindir ${_plugin_dir}) SET(_plugin_install_dir "${_INSTALL_DESTINATION}${_toplevel_plugindir}") # Install the directory without shared libraries INSTALL(DIRECTORY ${_plugin_dir} DESTINATION ${_INSTALL_DESTINATION} CONFIGURATIONS Debug PATTERN "Release/*" EXCLUDE PATTERN "bin/*" EXCLUDE PATTERN "lib/*" EXCLUDE) INSTALL(DIRECTORY ${_plugin_dir} DESTINATION ${_INSTALL_DESTINATION} CONFIGURATIONS Release PATTERN "Debug/*" EXCLUDE PATTERN "bin/*" EXCLUDE PATTERN "lib/*" EXCLUDE) SET(_target_install_rpath ${CMAKE_INSTALL_RPATH}) FOREACH(_dep ${_plugin_dependencies}) SET(_linklib_path "${${_dep}_OUT_DIR}") IF(_linklib_path) IF(BLUEBERRY_INSTALL_RPATH_RELATIVE) #MESSAGE("replace ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} with \".\" in ${_linklib_path} ") STRING(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "." _linklib_path "${_linklib_path}") ELSE() STRING(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "${CMAKE_INSTALL_PREFIX}/bin" _linklib_path "${_linklib_path}") ENDIF() LIST(APPEND _target_install_rpath "${_linklib_path}/bin") ENDIF() ENDFOREACH() SET_TARGET_PROPERTIES(${_INSTALL_TARGETS} PROPERTIES INSTALL_RPATH "${_target_install_rpath}") FOREACH(_install_target ${_INSTALL_TARGETS}) GET_TARGET_PROPERTY(_is_imported ${_install_target} IMPORTED) IF(_is_imported) GET_TARGET_PROPERTY(_import_loc_debug ${_install_target} IMPORTED_LOCATION_DEBUG) GET_TARGET_PROPERTY(_import_loc_release ${_install_target} IMPORTED_LOCATION_RELEASE) INSTALL(FILES ${_import_loc_debug} DESTINATION ${_plugin_install_dir}/bin CONFIGURATIONS Debug) INSTALL(FILES ${_import_loc_release} DESTINATION ${_plugin_install_dir}/bin CONFIGURATIONS Release) ELSE() INSTALL(TARGETS ${_INSTALL_TARGETS} RUNTIME DESTINATION ${_plugin_install_dir}/bin LIBRARY DESTINATION ${_plugin_install_dir}/bin #ARCHIVE DESTINATION ${_plugin_install_dir}/bin ) ENDIF() ENDFOREACH() + + ENDIF() # _INSTALL_TARGETS ENDMACRO() diff --git a/CMake/mitkInstallRules.cmake b/CMake/mitkInstallRules.cmake index 9117ef2163..d756e40dfc 100644 --- a/CMake/mitkInstallRules.cmake +++ b/CMake/mitkInstallRules.cmake @@ -1,82 +1,74 @@ MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/mitk.ico ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/mitk.bmp ) #STATEMACHINE XML MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Core/Code/Interactions/StateMachine.xml ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Config/mitkLevelWindowPresets.xml ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Config/mitkRigidRegistrationPresets.xml ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Config/mitkRigidRegistrationTestPresets.xml ) #QT if(MITK_USE_QT) find_package(Qt4) # this is not a godd idea since it adds the QT include directories to everything that is built below this directory #include(${QT_USE_FILE}) # TODO: use fixup_bundle(...) MITK_INSTALL_HELPER_APP(EXECUTABLES "${QT_ASSISTANT_EXECUTABLE}" ) endif(MITK_USE_QT) if(WIN32) #DCMTK Dlls install target (shared libs on gcc only) if(MINGW AND DCMTK_ofstd_LIBRARY) set(_dcmtk_libs ${DCMTK_dcmdata_LIBRARY} ${DCMTK_dcmimgle_LIBRARY} ${DCMTK_dcmnet_LIBRARY} ${DCMTK_ofstd_LIBRARY} ) foreach(_dcmtk_lib ${_dcmtk_libs}) MITK_INSTALL(FILES ${_dcmtk_lib} ) endforeach() endif() #BlueBerry if(MITK_USE_BLUEBERRY) - if(MINGW) - MITK_INSTALL(FILES ${BLUEBERRY_PLUGINS_OUTPUT_DIR}/org.blueberry.osgi/bin/liborg_blueberry_osgid.dll CONFIGURATIONS Debug) - MITK_INSTALL(FILES ${BLUEBERRY_PLUGINS_OUTPUT_DIR}/org.blueberry.osgi/bin/liborg_blueberry_osgi.dll CONFIGURATIONS Release) - else() - if(NOT APPLE) - MITK_INSTALL(FILES ${BLUEBERRY_PLUGINS_OUTPUT_DIR}/org.blueberry.osgi/bin/debug/liborg_blueberry_osgid.dll CONFIGURATIONS Debug) - MITK_INSTALL(FILES ${BLUEBERRY_PLUGINS_OUTPUT_DIR}/org.blueberry.osgi/bin/release/liborg_blueberry_osgi.dll CONFIGURATIONS Release) - endif(NOT APPLE) - endif() + MITK_INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/liborg_blueberry_osgi.dll) endif() #MinGW dll if(MINGW) find_library(MINGW_RUNTIME_DLL "mingwm10.dll" HINTS ${CMAKE_FIND_ROOT_PATH}/sys-root/mingw/bin) if(MINGW_RUNTIME_DLL) MITK_INSTALL(FILES ${MINGW_RUNTIME_DLL} ) else() message(SEND_ERROR "Could not find mingwm10.dll which is needed for a proper install") endif() find_library(MINGW_GCC_RUNTIME_DLL "libgcc_s_dw2-1.dll" HINTS ${CMAKE_FIND_ROOT_PATH}/sys-root/mingw/bin) if(MINGW_GCC_RUNTIME_DLL) MITK_INSTALL(FILES ${MINGW_GCC_RUNTIME_DLL} ) else() message(SEND_ERROR "Could not find libgcc_s_dw2-1.dll which is needed for a proper install") endif() endif() else() #DCMTK Dlls install target (shared libs on gcc only) if(DCMTK_ofstd_LIBRARY) set(_dcmtk_libs ${DCMTK_dcmdata_LIBRARY} ${DCMTK_dcmimgle_LIBRARY} ${DCMTK_dcmnet_LIBRARY} ${DCMTK_ofstd_LIBRARY} ) foreach(_dcmtk_lib ${_dcmtk_libs}) #MITK_INSTALL(FILES ${_dcmtk_lib} DESTINATION lib) endforeach() endif() endif() diff --git a/CMake/mitkMacroInstall.cmake b/CMake/mitkMacroInstall.cmake index 08710a902c..787b3e6b1c 100644 --- a/CMake/mitkMacroInstall.cmake +++ b/CMake/mitkMacroInstall.cmake @@ -1,137 +1,134 @@ # # MITK specific install macro # # On Mac everything is installed for each bundle listed in MACOSX_BUNDLE_NAMES # by replacing the DESTINATION parameter. Everything else is passed to the CMake INSTALL command # # Usage: MITK_INSTALL( ) # MACRO(MITK_INSTALL) SET(ARGS ${ARGN}) SET(install_directories "") LIST(FIND ARGS DESTINATION _destination_index) # SET(_install_DESTINATION "") IF(_destination_index GREATER -1) MESSAGE(SEND_ERROR "MITK_INSTALL macro must not be called with a DESTINATION parameter.") ### This code was a try to replace a given DESTINATION #MATH(EXPR _destination_index ${_destination_index} + 1) #LIST(GET ARGS ${_destination_index} _install_DESTINATION) #STRING(REGEX REPLACE ^bin "" _install_DESTINATION ${_install_DESTINATION}) ELSE() IF(NOT MACOSX_BUNDLE_NAMES) INSTALL(${ARGS} DESTINATION bin) ELSE() FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES}) INSTALL(${ARGS} DESTINATION ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION}) ENDFOREACH() ENDIF() ENDIF() ENDMACRO() # Fix _target_location # This is used in several install macros MACRO(_fixup_target) INSTALL(CODE " MACRO(gp_item_default_embedded_path_override item default_embedded_path_var) GET_FILENAME_COMPONENT(_item_name \"\${item}\" NAME) GET_FILENAME_COMPONENT(_item_path \"\${item}\" PATH) IF(_item_name MATCHES \"liborg\") IF(APPLE) SET(full_path \"full_path-NOTFOUND\") MESSAGE(\"override: \${item}\") FILE (GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} ) MESSAGE(\"find file: \${full_path}\") GET_FILENAME_COMPONENT(_item_path \"\${full_path}\" PATH) STRING(REPLACE \${CMAKE_INSTALL_PREFIX} @executable_path/../../../ \${default_embedded_path_var} \"\${_item_path}\" ) MESSAGE(\"override result: \${\${default_embedded_path_var}}\") ELSE() SET(\${default_embedded_path_var} \"\${_item_path}\") ENDIF() ENDIF() #IF(_item_name MATCHES \"^liborg\") # IF(APPLE) # MESSAGE(\"override: \${item}\") # STRING(REPLACE # ${CMAKE_INSTALL_PREFIX} # @loader_path/../ \${default_embedded_path_var} \"\${_item_path}\" ) # ELSE(APPLE) # SET(\${default_embedded_path_var} \"\${_item_path}\") # ENDIF(APPLE) #ENDIF() ENDMACRO(gp_item_default_embedded_path_override) MACRO(gp_resolved_file_type_override file type) IF(NOT APPLE) GET_FILENAME_COMPONENT(_file_path \"\${file}\" PATH) GET_FILENAME_COMPONENT(_file_name \"\${file}\" NAME) IF(_file_path MATCHES \"^\${CMAKE_INSTALL_PREFIX}\") SET(\${type} \"local\") # On linux, rpaths are removed from the plugins # if installing more than on application. This override # should prevent this. IF(_file_name MATCHES \"^liborg\") SET(\${type} \"system\") ENDIF() ENDIF() IF(_file_name MATCHES gdiplus) SET(\${type} \"system\") ENDIF(_file_name MATCHES gdiplus) ENDIF() ENDMACRO(gp_resolved_file_type_override) SET(_rpath_relative ${MITK_INSTALL_RPATH_RELATIVE}) IF(_rpath_relative AND NOT APPLE) IF(UNIX OR MINGW) MACRO(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) IF(\${item} MATCHES \"blueberry_osgi\") - SET(\${resolved_item_var} \"\${exepath}/BlueBerry/org.blueberry.osgi/bin/\${item}\") + SET(\${resolved_item_var} \"\${exepath}/plugins/\${item}\") SET(\${resolved_var} 1) ENDIF() ENDMACRO() ENDIF() ENDIF() IF(\"${_install_GLOB_PLUGINS}\" STREQUAL \"TRUE\") file(GLOB_RECURSE GLOBBED_BLUEBERRY_PLUGINS - # glob for all blueberry bundles of this application - \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/liborg*${CMAKE_SHARED_LIBRARY_SUFFIX}\" - ) - file(GLOB_RECURSE GLOBBED_QT_PLUGINS - # glob for Qt plugins - \"\${CMAKE_INSTALL_PREFIX}/${${_target_location}_qt_plugins_install_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\" - ) - ELSE() + # glob for all blueberry bundles of this application + \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/liborg*${CMAKE_SHARED_LIBRARY_SUFFIX}\") + ENDIF() + file(GLOB_RECURSE GLOBBED_QT_PLUGINS # glob for Qt plugins \"\${CMAKE_INSTALL_PREFIX}/${${_target_location}_qt_plugins_install_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") - ENDIF() # use custom version of BundleUtilities message(\"globbed plugins: \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_PLUGINS}\") - SET(PLUGIN_DIRS ${DIRS}) + SET(PLUGIN_DIRS) SET(PLUGINS ${_install_PLUGINS} \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_PLUGINS}) - if (PLUGINS) - list(REMOVE_DUPLICATES PLUGINS) - endif (PLUGINS) + if(PLUGINS) + list(REMOVE_DUPLICATES PLUGINS) + endif(PLUGINS) foreach(_plugin \${GLOBBED_BLUEBERRY_PLUGINS}) get_filename_component(_pluginpath \${_plugin} PATH) list(APPEND PLUGIN_DIRS \${_pluginpath}) - list(REMOVE_DUPLICATES PLUGIN_DIRS) endforeach(_plugin) + set(DIRS ${DIRS}) list(APPEND DIRS \${PLUGIN_DIRS}) + list(REMOVE_DUPLICATES DIRS) + # use custom version of BundleUtilities SET(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) include(BundleUtilities) - list(REMOVE_DUPLICATES PLUGIN_DIRS) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${PLUGIN_DIRS}\") + + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\") ") ENDMACRO()