diff --git a/CMake/mitkInstallRules.cmake b/CMake/mitkInstallRules.cmake index aee95a901b..8d4b47abac 100644 --- a/CMake/mitkInstallRules.cmake +++ b/CMake/mitkInstallRules.cmake @@ -1,83 +1,86 @@ 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}" ) + + # install the Qt Assistant executable, if Qt is used from a non-system location + if(QT_LIBRARY_DIR MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)") + # TODO: use fixup_bundle(...) + MITK_INSTALL_HELPER_APP(EXECUTABLES "${QT_ASSISTANT_EXECUTABLE}" ) + endif() 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 # Since this file is also included from external projects, you # can only use variables which are made available through MITKConfig.cmake if(MITK_USE_BLUEBERRY) if(MINGW) MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/liborg_blueberry_osgi.dll) else() if(NOT APPLE) MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/debug/liborg_blueberry_osgi.dll CONFIGURATIONS Debug) MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/release/liborg_blueberry_osgi.dll CONFIGURATIONS Release) endif(NOT APPLE) endif() 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/mitkMacroInstallHelperApp.cmake b/CMake/mitkMacroInstallHelperApp.cmake index 5a18902d09..ec34b403ce 100644 --- a/CMake/mitkMacroInstallHelperApp.cmake +++ b/CMake/mitkMacroInstallHelperApp.cmake @@ -1,110 +1,116 @@ #! MITK specific cross plattform install macro #! #! Usage: MITK_INSTALL_HELPER_APP(target1 [target2] ....) #! MACRO(MITK_INSTALL_HELPER_APP) MACRO_PARSE_ARGUMENTS(_install "TARGETS;EXECUTABLES;PLUGINS;LIBRARY_DIRS" "GLOB_PLUGINS" ${ARGN}) LIST(APPEND _install_TARGETS ${_install_DEFAULT_ARGS}) # TODO: how to supply to correct intermediate directory?? # CMAKE_CFG_INTDIR is not expanded to actual values inside the INSTALL(CODE "...") macro ... SET(intermediate_dir ) IF(WIN32 AND NOT MINGW) SET(intermediate_dir Release) ENDIF() SET(DIRS ${VTK_RUNTIME_LIBRARY_DIRS}/${intermediate_dir} ${ITK_LIBRARY_DIRS}/${intermediate_dir} ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR}/../bin ${MITK_BINARY_DIR}/bin/${intermediate_dir} ${_install_LIBRARY_DIRS} ) IF(APPLE) LIST(APPEND DIRS "/usr/lib") ENDIF(APPLE) if(QT_LIBRARY_DIR MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)") set(_qt_is_system_qt 1) endif() FOREACH(_target ${_install_EXECUTABLES}) SET(_qt_plugins_install_dirs "") SET(_qt_conf_install_dirs "") SET(_target_locations "") GET_FILENAME_COMPONENT(_target_name ${_target} NAME) IF(APPLE) IF(NOT MACOSX_BUNDLE_NAMES) SET(_qt_conf_install_dirs bin) SET(_target_locations bin/${_target_name}) SET(${_target_locations}_qt_plugins_install_dir bin) INSTALL(PROGRAMS ${_target} DESTINATION bin) ELSE() FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES}) LIST(APPEND _qt_conf_install_dirs ${bundle_name}.app/Contents/Resources) SET(_current_target_location ${bundle_name}.app/Contents/MacOS/${_target_name}) LIST(APPEND _target_locations ${_current_target_location}) SET(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS) INSTALL(PROGRAMS ${_target} DESTINATION ${bundle_name}.app/Contents/MacOS/) ENDFOREACH() ENDIF(NOT MACOSX_BUNDLE_NAMES) ELSE() SET(_target_locations bin/${_target_name}) SET(${_target_locations}_qt_plugins_install_dir bin) SET(_qt_conf_install_dirs bin) INSTALL(PROGRAMS ${_target} DESTINATION bin) + IF(UNIX) + # Remove the rpath from helper applications. We assume that all dependencies + # are installed into the same location as the helper application. + INSTALL(CODE "FILE(RPATH_REMOVE + FILE \"\${CMAKE_INSTALL_PREFIX}/${_target_location}\")") + ENDIF() ENDIF() FOREACH(_target_location ${_target_locations}) IF(NOT _qt_is_system_qt) IF(QT_PLUGINS_DIR) IF(WIN32) INSTALL(DIRECTORY "${QT_PLUGINS_DIR}" DESTINATION ${${_target_location}_qt_plugins_install_dir} CONFIGURATIONS Release FILES_MATCHING REGEX "[^4d]4?${CMAKE_SHARED_LIBRARY_SUFFIX}" ) INSTALL(DIRECTORY "${QT_PLUGINS_DIR}" DESTINATION ${${_target_location}_qt_plugins_install_dir} CONFIGURATIONS Debug FILES_MATCHING REGEX "d4?${CMAKE_SHARED_LIBRARY_SUFFIX}" ) ELSE(WIN32) # install everything, see bug 7143 INSTALL(DIRECTORY "${QT_PLUGINS_DIR}" DESTINATION ${${_target_location}_qt_plugins_install_dir} FILES_MATCHING REGEX "${CMAKE_SHARED_LIBRARY_SUFFIX}" ) ENDIF(WIN32) ENDIF() ENDIF() _fixup_target() ENDFOREACH(_target_location) IF(NOT _qt_is_system_qt) #-------------------------------------------------------------------------------- # install a qt.conf file # this inserts some cmake code into the install script to write the file SET(_qt_conf_plugin_install_prefix .) IF(APPLE) SET(_qt_conf_plugin_install_prefix ./MacOS) ENDIF() FOREACH(_qt_conf_install_dir ${_qt_conf_install_dirs}) INSTALL(CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${_qt_conf_install_dir}/qt.conf\" \" [Paths] Prefix=${_qt_conf_plugin_install_prefix} \")") ENDFOREACH() ENDIF() ENDFOREACH() ENDMACRO(MITK_INSTALL_HELPER_APP)