diff --git a/Applications/CoreApp/CMakeLists.txt b/Applications/CoreApp/CMakeLists.txt index 28a216b791..1c12cbe625 100644 --- a/Applications/CoreApp/CMakeLists.txt +++ b/Applications/CoreApp/CMakeLists.txt @@ -1,68 +1,66 @@ FIND_PACKAGE(BlueBerry REQUIRED) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES( ${BLUEBERRY_PLUGIN_SOURCE_DIRS} ${org_blueberry_osgi_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS} ${mbilog_INCLUDE_DIRS} ) LINK_DIRECTORIES(${Poco_LIBRARY_DIRS}) IF(MITK_SHOW_CONSOLE_WINDOW) ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE CoreApp.cpp) ELSE(MITK_SHOW_CONSOLE_WINDOW) ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE WIN32 CoreApp.cpp) ENDIF(MITK_SHOW_CONSOLE_WINDOW) IF (WIN32) FIND_PACKAGE(Qt4) TARGET_LINK_LIBRARIES(CoreApp ${QT_QTCORE_LIBRARY} ${QT_QTMAIN_LIBRARY}) ENDIF(WIN32) TARGET_LINK_LIBRARIES(CoreApp optimized PocoFoundation debug PocoFoundationd optimized PocoUtil debug PocoUtild org_blueberry_osgi) -SET_TARGET_PROPERTIES(CoreApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/plugins") - # subproject support ADD_DEPENDENCIES(MITK-CoreUI CoreApp) IF(MITK_ENABLE_GUI_TESTING) ADD_DEPENDENCIES(MITK-CoreUI solstice) ENDIF() SET(_plugin_deps ${BLUEBERRY_ENABLED_PLUGINS} ${MITK_CORE_ENABLED_PLUGINS} ) IF(_plugin_deps) # Make sure all enabled plug-ins are up to date ADD_DEPENDENCIES(CoreApp ${_plugin_deps}) ENDIF() SET(BLUEBERRY_PLUGIN_CACHE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugin_cache") CONFIGURE_FILE(CoreApp.ini ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.ini) IF(WIN32) FOREACH(COREAPP_BUILD_TYPE debug release) mitkFunctionCreateWindowsBatchScript(startCoreApp.bat.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/startCoreApp_${COREAPP_BUILD_TYPE}.bat ${COREAPP_BUILD_TYPE}) ENDFOREACH() ENDIF(WIN32) MITK_INSTALL_TARGETS(EXECUTABLES CoreApp GLOB_PLUGINS ) mitkFunctionInstallProvisioningFiles(${BLUEBERRY_PLUGIN_PROVISIONING_FILE} ${MITK_COREAPP_PROVISIONING_FILE}) -IF(UNIX AND MITK_INSTALL_RPATH_RELATIVE AND NOT APPLE) +IF(UNIX AND NOT APPLE) INSTALL(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME CoreApp.sh) ENDIF() SET(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "CoreApp;MITK - CoreApp Application" CACHE INTERNAL "Collecting windows shortcuts to executables") diff --git a/Applications/ExtApp/CMakeLists.txt b/Applications/ExtApp/CMakeLists.txt index cb642d3637..b5e6cdd7c0 100644 --- a/Applications/ExtApp/CMakeLists.txt +++ b/Applications/ExtApp/CMakeLists.txt @@ -1,66 +1,64 @@ FIND_PACKAGE(BlueBerry REQUIRED) # TODO: this can be removed after resolving factory issues, it's only necessary for the registration call in main() MITK_USE_MODULE(MitkExt) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES( ${BLUEBERRY_PLUGIN_SOURCE_DIRS} ${org_blueberry_osgi_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS} ${ALL_INCLUDE_DIRECTORIES} ) LINK_DIRECTORIES(${Poco_LIBRARY_DIRS}) IF(MITK_SHOW_CONSOLE_WINDOW) ADD_EXECUTABLE(ExtApp MACOSX_BUNDLE ExtApp.cpp) ELSE(MITK_SHOW_CONSOLE_WINDOW) ADD_EXECUTABLE(ExtApp MACOSX_BUNDLE WIN32 ExtApp.cpp) ENDIF(MITK_SHOW_CONSOLE_WINDOW) IF (WIN32) FIND_PACKAGE(Qt4) TARGET_LINK_LIBRARIES(ExtApp ${QT_QTCORE_LIBRARY} ${QT_QTMAIN_LIBRARY}) ENDIF(WIN32) TARGET_LINK_LIBRARIES(ExtApp optimized PocoFoundation debug PocoFoundationd optimized PocoUtil debug PocoUtild org_blueberry_osgi ${ALL_LIBRARIES}) -SET_TARGET_PROPERTIES(ExtApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/plugins") - SET(_plugin_deps ${BLUEBERRY_ENABLED_PLUGINS} ${MITK_EXT_ENABLED_PLUGINS} ${MITK_MODULES_ENABLED_PLUGINS} ) IF(_plugin_deps) # Make sure all enabled plug-ins are up to date ADD_DEPENDENCIES(ExtApp ${_plugin_deps}) ENDIF() SET(BLUEBERRY_PLUGIN_CACHE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugin_cache") CONFIGURE_FILE(ExtApp.ini ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtApp.ini) IF(WIN32) FOREACH(EXTAPP_BUILD_TYPE debug release) mitkFunctionCreateWindowsBatchScript(startExtApp.bat.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/startExtApp_${EXTAPP_BUILD_TYPE}.bat ${EXTAPP_BUILD_TYPE}) ENDFOREACH() ENDIF(WIN32) MITK_INSTALL_TARGETS(EXECUTABLES ExtApp GLOB_PLUGINS ) mitkFunctionInstallProvisioningFiles(${BLUEBERRY_PLUGIN_PROVISIONING_FILE} ${MITK_EXTAPP_PROVISIONING_FILE}) -IF(UNIX AND MITK_INSTALL_RPATH_RELATIVE AND NOT APPLE) +IF(UNIX AND NOT APPLE) INSTALL(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME ExtApp.sh) ENDIF() SET(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "ExtApp;MITK - ExtApp Application" CACHE INTERNAL "Collecting windows shortcuts to executables") diff --git a/BlueBerry/BlueBerryConfig.cmake.in b/BlueBerry/BlueBerryConfig.cmake.in index 01fe03bdf8..7de9bb803b 100644 --- a/BlueBerry/BlueBerryConfig.cmake.in +++ b/BlueBerry/BlueBerryConfig.cmake.in @@ -1,55 +1,58 @@ SET(BLUEBERRY_PLUGINS_SOURCE_DIR "@BLUEBERRY_PLUGINS_SOURCE_DIR@") SET(BLUEBERRY_PLUGINS_BINARY_DIR "@BLUEBERRY_PLUGINS_BINARY_DIR@") SET(BLUEBERRY_PLUGIN_SOURCE_DIRS "@BLUEBERRY_PLUGINS_SOURCE_DIR@") SET(BLUEBERRY_PLUGINS_OUTPUT_DIR "@BLUEBERRY_PLUGINS_OUTPUT_DIR@") SET(BLUEBERRY_SOURCE_DIR "@BLUEBERRY_SOURCE_DIR@") SET(BlueBerry_SOURCE_DIR "@BLUEBERRY_SOURCE_DIR@") SET(BLUEBERRY_BINARY_DIR "@BLUEBERRY_BINARY_DIR@") INCLUDE("@BB_PLUGIN_USE_FILE@") IF(NOT BB_PLUGIN_EXPORTS_FILE_INCLUDED AND NOT CMAKE_PROJECT_NAME STREQUAL "MITK") INCLUDE("@BB_PLUGIN_EXPORTS_FILE@") SET(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1) ENDIF() SET(BLUEBERRY_DEBUG_POSTFIX @BLUEBERRY_DEBUG_POSTFIX@) SET(BLUEBERRY_USE_QT_HELP @BLUEBERRY_USE_QT_HELP@) SET(QT_HELPGENERATOR_EXECUTABLE "@QT_HELPGENERATOR_EXECUTABLE@") SET(QT_COLLECTIONGENERATOR_EXECUTABLE "@QT_COLLECTIONGENERATOR_EXECUTABLE@") SET(QT_ASSISTANT_EXECUTABLE "@QT_ASSISTANT_EXECUTABLE@") SET(CTK_DIR "@CTK_DIR@") FIND_PACKAGE(CTK REQUIRED) +FIND_PACKAGE(Doxygen) + SET(BLUEBERRY_PLUGIN_TARGETS @my_plugin_targets@) SET(BLUEBERRY_ENABLED_PLUGINS @my_plugin_targets@) SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} @my_plugin_targets@) SET(BLUEBERRY_PLUGIN_PROVISIONING_FILE "@BLUEBERRY_PROVISIONING_FILE@") SET(BLUEBERRY_DOXYGEN_TAGFILE_NAME @BLUEBERRY_DOXYGEN_TAGFILE_NAME@) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@BLUEBERRY_SOURCE_DIR@/CMake") FIND_PACKAGE(Poco REQUIRED) SET(mbilog_DIR "@mbilog_DIR@") FIND_PACKAGE(mbilog REQUIRED) INCLUDE(MacroParseArguments) INCLUDE(MacroConvertSchema) INCLUDE(MacroOrganizeSources) INCLUDE(berryPluginHelpers) INCLUDE(MacroCollectPlugins) INCLUDE(MacroParseManifest) INCLUDE(MacroCreatePlugin) +INCLUDE(MacroCreateCTKPlugin) INCLUDE(MacroCreateQtHelp) INCLUDE(MacroInstallPlugin) INCLUDE(MacroInstallCTKPlugin) INCLUDE(MacroInstallThirdPartyPlugins) INCLUDE(FunctionInstallThirdPartyCTKPlugins) INCLUDE(FunctionCreateProvisioningFile) diff --git a/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake b/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake index 814781ce42..3e186325dc 100644 --- a/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake +++ b/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake @@ -1,47 +1,47 @@ function(FunctionCreateProvisioningFile) macro_parse_arguments(_PROV "FILE;INCLUDE;PLUGIN_DIR;PLUGINS" "" ${ARGN}) set(out_var ) set(out_var_install ) if(WIN32) set(file_url "file:///") else() set(file_url "file://") endif() foreach(incl ${_PROV_INCLUDE}) - string(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "@EXECUTABLE_DIR" incl_install ${incl}) + get_filename_component(incl_filename "${incl}" NAME) set(out_var "${out_var}READ ${file_url}${incl}\n") - set(out_var_install "${out_var_install}READ ${file_url}${incl_install}\n") + set(out_var_install "${out_var_install}READ ${file_url}@EXECUTABLE_DIR/${incl_filename}\n") endforeach() if(_PROV_INCLUDE) set(out_var "${out_var}\n") set(out_var_install "${out_var_install}\n") endif() string(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "@EXECUTABLE_DIR" _PROV_PLUGIN_DIR_install ${_PROV_PLUGIN_DIR}) foreach(plugin ${_PROV_PLUGINS}) ctkFunctionExtractOptionNameAndValue(${plugin} plugin_name_with_dirs plugin_value) string(REPLACE "/" ";" _tokens ${plugin_name_with_dirs}) list(GET _tokens -1 plugin_name) string(REPLACE "." "_" plugin_target ${plugin_name}) set(plugin_url "${file_url}${_PROV_PLUGIN_DIR}/lib${plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}") set(plugin_url_install "${file_url}${_PROV_PLUGIN_DIR_install}/lib${plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}") if(${${plugin_name_with_dirs}_option_name}) set(out_var "${out_var}START ${plugin_url}\n") set(out_var_install "${out_var_install}START ${plugin_url_install}\n") #else() # set(out_var "${out_var}STOP ${plugin_url}\n") # set(out_var_install "${out_var_install}STOP ${plugin_url_install}\n") endif() endforeach() file(WRITE ${_PROV_FILE} "${out_var}") file(WRITE ${_PROV_FILE}.install "${out_var_install}") endfunction() diff --git a/BlueBerry/CMake/MacroCreateCTKPlugin.cmake b/BlueBerry/CMake/MacroCreateCTKPlugin.cmake index 8cf7d8d7c7..cbb771c889 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) + SET(install_directories bin/plugins) ELSE(NOT MACOSX_BUNDLE_NAMES) FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES}) - LIST(APPEND install_directories ${bundle_name}.app/Contents/MacOS) + LIST(APPEND install_directories ${bundle_name}.app/Contents/MacOS/plugins) ENDFOREACH(bundle_name) ENDIF(NOT MACOSX_BUNDLE_NAMES) FOREACH(install_subdir ${install_directories}) MACRO_INSTALL_CTK_PLUGIN(TARGETS ${PLUGIN_TARGET} - DESTINATION bin/plugins) + DESTINATION ${install_subdir}) ENDFOREACH() ENDIF() ENDMACRO() diff --git a/BlueBerry/CMake/MacroInstallCTKPlugin.cmake b/BlueBerry/CMake/MacroInstallCTKPlugin.cmake index 3429551a38..0e71ff37c3 100644 --- a/BlueBerry/CMake/MacroInstallCTKPlugin.cmake +++ b/BlueBerry/CMake/MacroInstallCTKPlugin.cmake @@ -1,31 +1,43 @@ MACRO(MACRO_INSTALL_CTK_PLUGIN) MACRO_PARSE_ARGUMENTS(_INSTALL "TARGETS;DESTINATION" "" ${ARGN}) IF(NOT _INSTALL_DESTINATION) SET(_INSTALL_DESTINATION "bin/") ELSE() SET(_INSTALL_DESTINATION "${_INSTALL_DESTINATION}/") ENDIF() 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) + GET_FILENAME_COMPONENT(_target_filename_debug "${_import_loc_debug}" NAME) + GET_FILENAME_COMPONENT(_target_filename_release "${_import_loc_release}" NAME) INSTALL(FILES ${_import_loc_debug} DESTINATION ${_INSTALL_DESTINATION} CONFIGURATIONS Debug) INSTALL(FILES ${_import_loc_release} DESTINATION ${_INSTALL_DESTINATION} CONFIGURATIONS Release) + IF(UNIX AND NOT APPLE) + IF(_target_filename_debug) + INSTALL(CODE "FILE(RPATH_REMOVE + FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_debug}\")") + ENDIF() + IF(_target_filename_release) + INSTALL(CODE "FILE(RPATH_CHANGE + FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_release}\")") + ENDIF() + ENDIF() ELSE() INSTALL(TARGETS ${_install_target} RUNTIME DESTINATION ${_INSTALL_DESTINATION} LIBRARY DESTINATION ${_INSTALL_DESTINATION} #ARCHIVE DESTINATION ${_INSTALL_DESTINATION} ) ENDIF() ENDFOREACH() ENDMACRO() diff --git a/BlueBerry/CMakeLists.txt b/BlueBerry/CMakeLists.txt index 17ad694c0f..bf68825aa3 100644 --- a/BlueBerry/CMakeLists.txt +++ b/BlueBerry/CMakeLists.txt @@ -1,305 +1,295 @@ PROJECT(BlueBerry) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/") INCLUDE(MacroParseArguments) INCLUDE(MacroConvertSchema) INCLUDE(MacroOrganizeSources) INCLUDE(berryPluginHelpers) INCLUDE(MacroCollectPlugins) INCLUDE(MacroParseManifest) INCLUDE(MacroCreatePlugin) INCLUDE(MacroCreateCTKPlugin) INCLUDE(MacroCreateQtHelp) INCLUDE(MacroInstallPlugin) INCLUDE(MacroInstallCTKPlugin) INCLUDE(FunctionCreateProvisioningFile) -OPTION(BLUEBERRY_INSTALL_RPATH_RELATIVE "Use relative rpath entries when installing" OFF) -MARK_AS_ADVANCED(BLUEBERRY_INSTALL_RPATH_RELATIVE) - -IF(BLUEBERRY_INSTALL_RPATH_RELATIVE) - SET(CMAKE_INSTALL_RPATH ".") -ELSE() - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin") -ENDIF() - - IF(MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4275 /wd4251 /wd4503") ENDIF() IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) ENDIF () FIND_PACKAGE(mbilog REQUIRED) INCLUDE_DIRECTORIES(${mbilog_INCLUDE_DIRS}) OPTION(BLUEBERRY_USE_QT "Use the Qt GUI toolkit" OFF) IF(NOT DESIRED_QT_VERSION) SET(DESIRED_QT_VERSION 4 CACHE STRING "Desired Qt version" FORCE) MARK_AS_ADVANCED(DESIRED_QT_VERSION) ENDIF() IF(BLUEBERRY_USE_QT AND NOT DESIRED_QT_VERSION EQUAL 4) MESSAGE("Attention: Qt4 GUI libraries are required to build the BlueBerry Qt plug-ins.") ENDIF() IF(BLUEBERRY_USE_QT AND DESIRED_QT_VERSION EQUAL 4) SET(BUILD_QT_PLUGINS 1) FIND_PACKAGE(Qt4 4.6.2 REQUIRED) IF(QT_QMAKE_CHANGED) SET(QT_HELPGENERATOR_EXECUTABLE NOTFOUND) SET(QT_COLLECTIONGENERATOR_EXECUTABLE NOTFOUND) SET(QT_ASSISTANT_EXECUTABLE NOTFOUND) ENDIF() FIND_PROGRAM(QT_HELPGENERATOR_EXECUTABLE NAMES qhelpgenerator qhelpgenerator-qt4 qhelpgenerator4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_COLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_ASSISTANT_EXECUTABLE NAMES assistant-qt4 assistant4 assistant PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) OPTION(BLUEBERRY_USE_QT_HELP "Enable support for integrating bundle documentation into Qt Help" ON) MARK_AS_ADVANCED(BLUEBERRY_USE_QT_HELP QT_HELPGENERATOR_EXECUTABLE QT_COLLECTIONGENERATOR_EXECUTABLE QT_ASSISTANT_EXECUTABLE) SET(_doxygen_too_old 1) IF(BLUEBERRY_USE_QT_HELP) FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) EXECUTE_PROCESS(COMMAND ${DOXYGEN_EXECUTABLE} --version OUTPUT_VARIABLE _doxygen_version) IF(${_doxygen_version} VERSION_GREATER 1.6.0 OR ${_doxygen_version} VERSION_EQUAL 1.6.0) SET(_doxygen_too_old 0) ENDIF() ENDIF() ELSE(BLUEBERRY_USE_QT_HELP) CONFIGURE_FILE(../Documentation/pregenerated/MITKBlankPage.qch ${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MITKBlankPage.qch COPYONLY) CONFIGURE_FILE(../Documentation/pregenerated/MitkExtQtHelpCollection.qhc ${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MitkExtQtHelpCollection.qhc COPYONLY) ENDIF(BLUEBERRY_USE_QT_HELP) IF (BLUEBERRY_USE_QT_HELP AND _doxygen_too_old) MESSAGE("Doxygen was not found or is too old. Version 1.6.0 or later is needed if BLUEBERRY_USE_QT_HELP is ON") SET(BLUEBERRY_USE_QT_HELP OFF CACHE BOOL "Enable support for integrating bundle documentation into Qt Help" FORCE) ENDIF() IF(BLUEBERRY_USE_QT_HELP AND NOT QT_HELPGENERATOR_EXECUTABLE) MESSAGE("You have enabled Qt Help support, but QT_HELPGENERATOR_EXECUTABLE is empty") SET(BLUEBERRY_USE_QT_HELP OFF CACHE BOOL "Enable support for integrating bundle documentation into Qt Help" FORCE) ENDIF() INCLUDE(${QT_USE_FILE}) ELSE() FIND_PACKAGE(Qt4 4.6.2 COMPONENTS QtCore REQUIRED) INCLUDE(${QT_USE_FILE}) ENDIF() # ========= CTK specific CMake stuff ============ CMAKE_POLICY(SET CMP0012 NEW) FIND_PACKAGE(CTK REQUIRED) SET(CTK_PLUGIN_LIBRARIES "${CTK_PLUGIN_LIBRARIES}" CACHE INTERNAL "CTK plugins" FORCE) # Extract all library names starting with org_blueberry_ MACRO(GetMyTargetLibraries all_target_libraries varname) SET(re_ctkplugin "^org_blueberry_[a-zA-Z0-9_]+$") SET(_tmp_list) LIST(APPEND _tmp_list ${all_target_libraries}) ctkMacroListFilter(_tmp_list re_ctkplugin OUTPUT_VARIABLE ${varname}) ENDMACRO() # ================================================ OPTION(BLUEBERRY_BUILD_ALL_PLUGINS "Build all BlueBerry plugins (overriding selection)" OFF) MARK_AS_ADVANCED(BLUEBERRY_BUILD_ALL_PLUGINS) IF(BLUEBERRY_BUILD_ALL_PLUGINS) SET(BLUEBERRY_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL") ENDIF() OPTION(BLUEBERRY_STATIC "Build all plugins as static libraries" OFF) MARK_AS_ADVANCED(BLUEBERRY_STATIC) OPTION(BLUEBERRY_DEBUG_SMARTPOINTER "Enable code for debugging smart pointers" OFF) MARK_AS_ADVANCED(BLUEBERRY_DEBUG_SMARTPOINTER) FIND_PACKAGE(Poco REQUIRED) FIND_PACKAGE(Ant) FIND_PACKAGE(Eclipse) SET(BLUEBERRY_SOURCE_DIR ${BlueBerry_SOURCE_DIR}) SET(BLUEBERRY_BINARY_DIR ${BlueBerry_BINARY_DIR}) SET(BLUEBERRY_PLUGINS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Bundles) SET(BLUEBERRY_PLUGINS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Bundles) SET(OSGI_APP solstice) SET(OSGI_UI_APP solstice_ui) # Force should be removed after everybody has configured their old binary tree SET(BLUEBERRY_PLUGINS_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/BlueBerry CACHE PATH "Directory where to build the BlueBerry Bundles" FORCE) MARK_AS_ADVANCED(BLUEBERRY_PLUGINS_OUTPUT_DIR) # Clear the cache variables SET(BLUEBERRY_PLUGIN_SOURCE_DIRS "" CACHE INTERNAL "List of base plugin source directories" FORCE) SET(BLUEBERRY_PLUGIN_BINARY_DIRS "" CACHE INTERNAL "List of base plugin binary directories" FORCE) IF (Eclipse_DIR) SET(BLUEBERRY_DOC_TOOLS_DIR "${Eclipse_DIR}" CACHE PATH "Directory containing additional tools needed for generating the documentation") ELSE () SET(BLUEBERRY_DOC_TOOLS_DIR "" CACHE PATH "Directory containing additional tools needed for generating the documentation") ENDIF () SET(BLUEBERRY_DEBUG_POSTFIX d) # Testing options OPTION(BLUEBERRY_BUILD_TESTING "Build the BlueBerry tests." ${BUILD_TESTING}) IF(WIN32) SET(_gui_testing_default "ON") ELSE() SET(_gui_testing_default "OFF") ENDIF() OPTION(BLUEBERRY_ENABLE_GUI_TESTING "Enable the BlueBerry GUI tests" ${_gui_testing_default}) MARK_AS_ADVANCED(BLUEBERRY_ENABLE_GUI_TESTING) IF(BLUEBERRY_BUILD_TESTING) ENABLE_TESTING() ENDIF() # Add CTK plugins SET(_ctk_plugins Bundles/org.blueberry.osgi:ON Bundles/org.blueberry.compat:ON Bundles/org.blueberry.core.runtime:ON Bundles/org.blueberry.core.expressions:ON Bundles/org.blueberry.solstice.common:ON Bundles/org.blueberry.core.commands:ON Bundles/org.blueberry.core.jobs:OFF Bundles/org.blueberry.ui:ON Bundles/org.blueberry.ui.qt:ON Bundles/org.blueberry.ui.qt.log:OFF Bundles/org.blueberry.ui.qt.objectinspector:OFF ) SET(_ctk_test_plugins ) SET(_ctk_plugins_include_dirs ${Poco_INCLUDE_DIRS} ) SET(_ctk_plugins_link_dirs ${Poco_LIBRARY_DIR} ) INCLUDE_DIRECTORIES(${_ctk_plugins_include_dirs}) LINK_DIRECTORIES(${_ctk_plugins_link_dirs}) IF(BLUEBERRY_BUILD_TESTING) INCLUDE(berryTestingHelpers) SET(BLUEBERRY_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_APP}") GET_TARGET_PROPERTY(_is_macosx_bundle ${OSGI_APP} MACOSX_BUNDLE) IF(APPLE AND _is_macosx_bundle) SET(BLUEBERRY_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_APP}.app/Contents/MacOS/${OSGI_APP}") ENDIF() LIST(APPEND _ctk_plugins Bundles/org.blueberry.test:ON Bundles/org.blueberry.uitest:ON ) SET(_ctk_test_plugins # Testing/org.blueberry.core.runtime.tests:ON # Testing/org.blueberry.osgi.tests:ON ) IF(BLUEBERRY_ENABLE_GUI_TESTING) # LIST(APPEND _ctk_test_plugins Testing/org.blueberry.ui.tests:ON) SET(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_UI_APP}") GET_TARGET_PROPERTY(_is_macosx_bundle ${OSGI_UI_APP} MACOSX_BUNDLE) IF(APPLE AND _is_macosx_bundle) SET(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_UI_APP}.app/Contents/MacOS/${OSGI_UI_APP}") ENDIF() ENDIF() ENDIF() SET(BLUEBERRY_TESTING_PROVISIONING_FILE "${BlueBerry_BINARY_DIR}/BlueBerryTesting.provisioning") ADD_CUSTOM_TARGET(BlueBerry) ctkMacroSetupExternalPlugins(${_ctk_plugins} ${_ctk_test_plugins} BUILD_OPTION_PREFIX BLUEBERRY_BUILD_ BUILD_ALL ${BLUEBERRY_BUILD_ALL_PLUGINS} COMPACT_OPTIONS) SET(BLUEBERRY_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/BlueBerry.provisioning") FunctionCreateProvisioningFile( FILE ${BLUEBERRY_PROVISIONING_FILE} PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins" PLUGINS ${_ctk_plugins} ) FunctionCreateProvisioningFile( FILE ${BLUEBERRY_TESTING_PROVISIONING_FILE} INCLUDE ${BLUEBERRY_PROVISIONING_FILE} PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_plugins" PLUGINS ${_ctk_test_plugins} ) ctkMacroGetAllProjectTargetLibraries("${CTK_PLUGIN_LIBRARIES}" _enabled_plugin_targets) add_dependencies(BlueBerry ${_enabled_plugin_targets}) set_property(TARGET ${_enabled_plugin_targets} PROPERTY LABELS BlueBerry) SET(BB_PLUGIN_USE_FILE "${BlueBerry_BINARY_DIR}/BlueBerryPluginUseFile.cmake") ctkFunctionGeneratePluginUseFile(${BB_PLUGIN_USE_FILE}) # CTK Plugin Exports SET(BB_PLUGIN_EXPORTS_FILE "${CMAKE_CURRENT_BINARY_DIR}/BlueBerryPluginExports.cmake") GetMyTargetLibraries("${CTK_PLUGIN_LIBRARIES}" my_plugin_targets) SET(additional_export_targets mbilog PocoFoundation PocoUtil PocoXML) IF(BLUEBERRY_BUILD_TESTING) LIST(APPEND additional_export_targets CppUnit) ENDIF() export(TARGETS ${my_plugin_targets} ${additional_export_targets} FILE ${BB_PLUGIN_EXPORTS_FILE}) ADD_SUBDIRECTORY(Documentation) CONFIGURE_FILE(BlueBerryConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BlueBerryConfig.cmake @ONLY) diff --git a/CMake/FindGit.cmake b/CMake/FindGit.cmake index bcde2e43aa..97b4815eaf 100644 --- a/CMake/FindGit.cmake +++ b/CMake/FindGit.cmake @@ -1,58 +1,80 @@ # # FindGit # -SET(GIT_FOUND FALSE) - -FIND_PROGRAM(GIT_EXECUTABLE git +SET(git_candidates git eg) + +IF(WIN32) + LIST(APPEND git_candidates eg.cmd) + IF(NOT MSYS) + # We don't append git.cmd, since it does not correctly return + # exit codes, see http://code.google.com/p/msysgit/issues/detail?id=428 + LIST(APPEND git_candidates git.cmd) + ENDIF() +ENDIF() + +FIND_PROGRAM(GIT_EXECUTABLE ${git_candidates} PATHS "C:/Program Files/Git/bin" "C:/Program Files (x86)/Git/bin" DOC "git command line client") MARK_AS_ADVANCED(GIT_EXECUTABLE) IF(GIT_EXECUTABLE) - SET(GIT_FOUND TRUE) + + MACRO(GIT_IS_REPO dir result_var) + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} status + WORKING_DIRECTORY ${dir} + RESULT_VARIABLE GIT_error + OUTPUT_QUIET + ERROR_QUIET) + if(GIT_error EQUAL 0) + SET(${result_var} 1) + ELSE() + SET(${result_var} 0) + ENDIF() + ENDMACRO() + MACRO(GIT_WC_INFO dir prefix) EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-list -n 1 HEAD WORKING_DIRECTORY ${dir} ERROR_VARIABLE GIT_error OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT ${GIT_error} EQUAL 0) + IF(NOT ${GIT_error} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${GIT_EXECUTBALE} rev-list -n 1 HEAD\" in directory ${dir} failed with output:\n${GIT_error}") - ELSE(NOT ${GIT_error} EQUAL 0) + ELSE() EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH} WORKING_DIRECTORY ${dir} OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) - ENDIF(NOT ${GIT_error} EQUAL 0) + ENDIF() + SET(${prefix}_WC_GITSVN 0) # In case, git-svn is used, attempt to extract svn info EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} svn info WORKING_DIRECTORY ${dir} ERROR_VARIABLE git_svn_info_error OUTPUT_VARIABLE ${prefix}_WC_INFO RESULT_VARIABLE git_svn_info_result OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(NOT ${git_svn_info_result} EQUAL 0) - #MESSAGE(SEND_ERROR "Command \"${GIT_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${git_svn_info_error}") - ELSE(NOT ${git_svn_info_result} EQUAL 0) - + IF(${git_svn_info_result} EQUAL 0) + SET(${prefix}_WC_GITSVN 1) STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") - - ENDIF(NOT ${git_svn_info_result} EQUAL 0) + ENDIF() - ENDMACRO(GIT_WC_INFO) -ENDIF(GIT_EXECUTABLE) + ENDMACRO() +ENDIF() +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/CMake/RunInstalledApp.sh b/CMake/RunInstalledApp.sh index 41b1d1c2c8..f436f10640 100644 --- a/CMake/RunInstalledApp.sh +++ b/CMake/RunInstalledApp.sh @@ -1,6 +1,6 @@ #!/bin/sh binpath=$(dirname $(readlink -f $0)) appname=$(basename $0 .sh) -export LD_LIBRARY_PATH=$binpath/bin:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=$binpath/bin:$binpath/bin/plugins:$LD_LIBRARY_PATH cd $binpath/bin -./$appname +./$appname $* diff --git a/CMake/mitkFunctionGetVersion.cmake b/CMake/mitkFunctionGetVersion.cmake index b92ab2a042..659c04e01d 100644 --- a/CMake/mitkFunctionGetVersion.cmake +++ b/CMake/mitkFunctionGetVersion.cmake @@ -1,28 +1,78 @@ +#! \brief Extract version information from a local working copy #! -#! Extracts the current git revision hash and branch/tag name -#! and provides these in ${prefix}_WC_REVISION_HASH and -#! ${prefix}_WC_REVISION_NAME +#! If the source_dir variable points to a git repository, this function +#! extracts the current revision hash and branch/tag name. #! -#! \param source_dir The directory containing a git repository +#! If the source_dir variable points to a subversion repository, this +#! function extracts the current svn revision. +# +#! The information is provided in +#! \ul +#! \li ${prefix}_REVISION_ID The git hash or svn revision value +#! \li ${prefix}_REVISION_NAME The git branch/tag name or empty +#! \li ${prefix}_WC_TYPE The working copy type, one of "local", "git", or "svn" +#! \lu +#! +#! \param source_dir The directory containing a working copy #! \param prefix A prefix to prepend to the variables containing -#! the revision hash and name. +#! the extracted information. #! function(mitkFunctionGetVersion source_dir prefix) + + if(NOT prefix) + message(FATAL_ERROR "prefix argument not specified") + endif() + + # initialize variables + set(_wc_type "local") + set(_wc_id "") + set(_wc_name "") + + find_package(Git) if(GIT_FOUND) - GIT_WC_INFO(${source_dir} ${prefix}) + + GIT_IS_REPO(${source_dir} _is_git_repo) + if(_is_git_repo) + set(_wc_type "git") + GIT_WC_INFO(${source_dir} ${prefix}) + + set(_wc_id ${${prefix}_WC_REVISION_HASH}) - if(NOT ${prefix}_WC_REVISION_HASH) - set(${prefix}_WC_REVISION_HASH "n/a") + string(REPLACE " " ";" hash_name ${${prefix}_WC_REVISION_NAME}) + list(GET hash_name 1 name) + if(name) + set(_wc_name ${name}) + endif() endif() - - string(REPLACE " " ";" hash_name ${${prefix}_WC_REVISION_NAME}) - list(GET hash_name 1 name) - if (NOT name) - set(name "n/a") + endif() + + # test for svn working copy + if(_wc_type STREQUAL "local") + + find_package(Subversion) + if(Subversion_FOUND) + execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info + WORKING_DIRECTORY ${source_dir} + RESULT_VARIABLE _subversion_result + OUTPUT_QUIET + ERROR_QUIET) + + if(NOT _subversion_result) + set(_wc_type svn) + Subversion_WC_INFO(${source_dir} ${prefix}) + set(_wc_id ${${prefix}_WC_REVISION}) + endif() endif() - - set(${prefix}_WC_REVISION_HASH ${${prefix}_WC_REVISION_HASH} PARENT_SCOPE) - set(${prefix}_WC_REVISION_NAME ${name} PARENT_SCOPE) + endif() + + set(${prefix}_WC_TYPE ${_wc_type} PARENT_SCOPE) + set(${prefix}_REVISION_ID ${_wc_id} PARENT_SCOPE) + set(${prefix}_REVISION_NAME ${_wc_name} PARENT_SCOPE) + + # For backwards compatibility + set(${prefix}_WC_REVISION_HASH ${_wc_id} PARENT_SCOPE) + set(${prefix}_WC_REVISION_NAME ${_wc_name} PARENT_SCOPE) + endfunction() diff --git a/CMake/mitkMacroInstall.cmake b/CMake/mitkMacroInstall.cmake index 83a275f61a..99f4d61069 100644 --- a/CMake/mitkMacroInstall.cmake +++ b/CMake/mitkMacroInstall.cmake @@ -1,135 +1,125 @@ # # 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\") + + # We have to fix all path references to build trees for plugins + + IF(NOT _item_path MATCHES \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\") + # item with relative path or embedded path pointing to some build dir + SET(full_path \"full_path-NOTFOUND\") + FILE (GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} ) + GET_FILENAME_COMPONENT(_item_path \"\${full_path}\" PATH) + ENDIF() + + IF(_item_path STREQUAL \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/plugins\" + OR _item_name MATCHES \"liborg\" # this is for legacy BlueBerry bundle support + ) + # Only fix plugins + MESSAGE(\"override: \${item}\") + MESSAGE(\"found file: \${_item_path}/\${_item_name}\") 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}}\") + \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir} + @executable_path \${default_embedded_path_var} \"\${_item_path}\" ) ELSE() SET(\${default_embedded_path_var} \"\${_item_path}\") ENDIF() + MESSAGE(\"override result: \${\${default_embedded_path_var}}\") 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(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\") GET_FILENAME_COMPONENT(_item_name \${item} NAME) SET(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\") 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}\") 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}\") # use custom version of BundleUtilities message(\"globbed plugins: \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_PLUGINS}\") SET(PLUGIN_DIRS) SET(PLUGINS ${_install_PLUGINS} \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_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}) 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) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\") ") ENDMACRO() diff --git a/CMake/mitkMacroInstallTargets.cmake b/CMake/mitkMacroInstallTargets.cmake index 6575dd6e3d..532c9a6046 100644 --- a/CMake/mitkMacroInstallTargets.cmake +++ b/CMake/mitkMacroInstallTargets.cmake @@ -1,138 +1,138 @@ # # MITK specific cross plattform install macro # # Usage: MITK_INSTALL_TARGETS(target1 [target2] ....) # MACRO(MITK_INSTALL_TARGETS) MACRO_PARSE_ARGUMENTS(_install "TARGETS;EXECUTABLES;PLUGINS;LIBRARY_DIRS" "GLOB_PLUGINS" ${ARGN}) LIST(APPEND _install_TARGETS ${_install_DEFAULT_ARGS}) # TODO: how to supply the 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} + ${MITK_VTK_LIBRARY_DIRS}/${intermediate_dir} + ${MITK_ITK_LIBRARY_DIRS}/${intermediate_dir} ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR}/../bin ${MITK_BINARY_DIR}/bin/${intermediate_dir} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${intermediate_dir} ) FOREACH(_lib_dir ${_install_LIBRARY_DIRS}) LIST(APPEND DIRS ${_lib_dir}/${intermediate_dir}) ENDFOREACH() IF(GDCM_DIR) LIST(APPEND DIRS ${GDCM_DIR}/bin/${intermediate_dir}) ENDIF() IF(OpenCV_DIR) LIST(APPEND DIRS ${OpenCV_DIR}/bin/${intermediate_dir}) ENDIF() IF(MITK_USE_BLUEBERRY) LIST(APPEND DIRS ${CTK_RUNTIME_LIBRARY_DIRS}/${intermediate_dir}) ENDIF() LIST(REMOVE_DUPLICATES DIRS) 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}) GET_TARGET_PROPERTY(_is_bundle ${_target} MACOSX_BUNDLE) SET(_qt_plugins_install_dirs "") SET(_qt_conf_install_dirs "") SET(_target_locations "") IF(APPLE) IF(_is_bundle) SET(_target_locations ${_target}.app) SET(${_target_locations}_qt_plugins_install_dir ${_target}.app/Contents/MacOS) SET(_bundle_dest_dir ${_target}.app/Contents/MacOS) SET(_qt_plugins_for_current_bundle ${_target}.app/Contents/MacOS) SET(_qt_conf_install_dirs ${_target}.app/Contents/Resources) INSTALL(TARGETS ${_target} BUNDLE DESTINATION . ) ELSE() IF(NOT MACOSX_BUNDLE_NAMES) SET(_qt_conf_install_dirs bin) SET(_target_locations bin/${_target}) SET(${_target_locations}_qt_plugins_install_dir bin) INSTALL(TARGETS ${_target} RUNTIME 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}) LIST(APPEND _target_locations ${_current_target_location}) SET(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS) MESSAGE( " SET(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS) ") INSTALL(TARGETS ${_target} RUNTIME DESTINATION ${bundle_name}.app/Contents/MacOS/) ENDFOREACH() ENDIF() ENDIF() ELSE() SET(_target_locations bin/${_target}${CMAKE_EXECUTABLE_SUFFIX}) SET(${_target_locations}_qt_plugins_install_dir bin) SET(_qt_conf_install_dirs bin) INSTALL(TARGETS ${_target} RUNTIME DESTINATION bin) 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() 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() diff --git a/CMake/mitkSetupBlueBerry.cmake b/CMake/mitkSetupBlueBerry.cmake index 8b1a0efe63..14332f43e1 100644 --- a/CMake/mitkSetupBlueBerry.cmake +++ b/CMake/mitkSetupBlueBerry.cmake @@ -1,33 +1,31 @@ -set(BLUEBERRY_INSTALL_RPATH_RELATIVE ${MITK_INSTALL_RPATH_RELATIVE} - CACHE BOOL "Use relative rpath entries when installing" FORCE) set(BLUEBERRY_USE_QT ${MITK_USE_QT} CACHE BOOL "Use the Qt GUI toolkit" FORCE) mark_as_advanced(BLUEBERRY_USE_QT) # Clear the cache variables containing plugin base directories set(MITK_MODULES_PLUGIN_SOURCE_DIRS "" CACHE INTERNAL "List of base plugin source directories" FORCE) set(MITK_MODULES_PLUGIN_OUTPUT_DIRS "" CACHE INTERNAL "List of base plugin output directories" FORCE) set(mbilog_DIR "${mbilog_BINARY_DIR}") if(MITK_BUILD_ALL_PLUGINS) set(BLUEBERRY_BUILD_ALL_PLUGINS ON) endif() add_subdirectory(BlueBerry) set(BlueBerry_DIR ${CMAKE_CURRENT_BINARY_DIR}/BlueBerry CACHE PATH "The directory containing a CMake configuration file for BlueBerry" FORCE) include(${BlueBerry_DIR}/BlueBerryConfig.cmake) include(mitkMacroCreatePlugin) include(mitkMacroCreateCTKPlugin) SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} CACHE INTERNAL "CTK plugins" FORCE) # Extract all library names starting with org_mitk_ MACRO(GetMyTargetLibraries all_target_libraries varname) SET(re_ctkplugin "^org_mitk_[a-zA-Z0-9_]+$") SET(_tmp_list) LIST(APPEND _tmp_list ${all_target_libraries}) ctkMacroListFilter(_tmp_list re_ctkplugin OUTPUT_VARIABLE ${varname}) ENDMACRO() diff --git a/CMake/mitkSetupCPack.cmake b/CMake/mitkSetupCPack.cmake index bab79daed4..968fb0274d 100644 --- a/CMake/mitkSetupCPack.cmake +++ b/CMake/mitkSetupCPack.cmake @@ -1,50 +1,58 @@ # # First, set the generator variable # IF(NOT CPACK_GENERATOR) IF(WIN32) FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] DOC "Where is makensis.exe located" ) IF(NOT NSIS_MAKENSIS) SET(CPACK_GENERATOR ZIP) ELSE() SET(CPACK_GENERATOR "NSIS;ZIP") ENDIF(NOT NSIS_MAKENSIS) ELSE() IF(APPLE) SET(CPACK_GENERATOR DragNDrop) ELSE() SET(CPACK_GENERATOR TGZ) ENDIF() ENDIF() ENDIF(NOT CPACK_GENERATOR) # include required mfc libraries INCLUDE(InstallRequiredSystemLibraries) SET(CPACK_PACKAGE_NAME "MITK") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MITK is a medical image processing tool") SET(CPACK_PACKAGE_VENDOR "German Cancer Research Center (DKFZ)") SET(CPACK_CREATE_DESKTOP_LINKS "ExtApp") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${MITK_SOURCE_DIR}/MITKCopyright.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${MITK_SOURCE_DIR}/MITKCopyright.txt") SET(CPACK_PACKAGE_VERSION_MAJOR "${MITK_VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${MITK_VERSION_MINOR}") # tell cpack to strip all debug symbols from all files SET(CPACK_STRIP_FILES ON) # append revision number if available -IF(MITK_WC_REVISION_HASH) - STRING(SUBSTRING ${MITK_WC_REVISION_HASH} 0 6 git_hash) - SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${git_hash}") +IF(MITK_REVISION_ID) + IF(MITK_WC_TYPE STREQUAL "git") + SET(git_hash ${MITK_REVISION_ID}) + STRING(LENGTH "${git_hash}" hash_length) + IF(hash_length GREATER 6) + STRING(SUBSTRING ${git_hash} 0 6 git_hash) + ENDIF() + SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${git_hash}") + ELSE() + SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${MITK_REVISION_ID}") + ENDIF() ELSE() SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}") ENDIF() diff --git a/CMake/mitkSetupVariables.cmake b/CMake/mitkSetupVariables.cmake index 9981436fad..4f8132f6ef 100644 --- a/CMake/mitkSetupVariables.cmake +++ b/CMake/mitkSetupVariables.cmake @@ -1,142 +1,146 @@ if(MITK_BUILD_ALL_PLUGINS) set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL") endif() set(LIBPOSTFIX "") # MITK_VERSION set(MITK_VERSION_MAJOR "0") set(MITK_VERSION_MINOR "15") set(MITK_VERSION_PATCH "1") set(MITK_VERSION_STRING "${MITK_VERSION_MAJOR}.${MITK_VERSION_MINOR}.${MITK_VERSION_PATCH}") if(NOT UNIX AND NOT MINGW) set(MITK_WIN32_FORCE_STATIC "STATIC" CACHE INTERNAL "Use this variable to always build static libraries on non-unix platforms") endif() # build the MITK_INCLUDE_DIRS variable set(MITK_INCLUDE_DIRS ${PROJECT_BINARY_DIR}) set(CORE_DIRECTORIES DataManagement Algorithms IO Rendering Interactions Controllers) foreach(d ${CORE_DIRECTORIES}) list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Core/Code/${d}) endforeach() #list(APPEND MITK_INCLUDE_DIRS #${ITK_INCLUDE_DIRS} #${VTK_INCLUDE_DIRS} # ) foreach(d Utilities Utilities/ipPic Utilities/IIL4MITK Utilities/pic2vtk Utilities/tinyxml Utilities/mbilog) list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}) endforeach() if(WIN32) list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipPic/win32) endif() # additional include dirs variables set(ANN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ann/include) set(IPSEGMENTATION_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipSegmentation) # variables containing librariy names set(MITK_CORE_LIBRARIES mitkCore) set(VTK_FOR_MITK_LIBRARIES vtkGraphics vtkCommon vtkFiltering vtkftgl vtkGraphics vtkHybrid vtkImaging vtkIO vtkParallel vtkRendering vtkVolumeRendering vtkWidgets ${VTK_JPEG_LIBRARIES} ${VTK_PNG_LIBRARIES} ${VTK_ZLIB_LIBRARIES} ${VTK_EXPAT_LIBRARIES} ${VTK_FREETYPE_LIBRARIES} ) # TODO: maybe solve this with lib depends mechanism of CMake set(UTIL_FOR_MITK_LIBRARIES mitkIpPic mitkIpFunc mbilog) set(LIBRARIES_FOR_MITK_CORE ${UTIL_FOR_MITK_LIBRARIES} ${VTK_FOR_MITK_LIBRARIES} ${ITK_LIBRARIES} ) set(MITK_LIBRARIES ${MITK_CORE_LIBRARIES} ${LIBRARIES_FOR_MITK_CORE} pic2vtk IIL4MITK ipSegmentation ann ) + +# variables used in CMake macros which are called from external projects +set(MITK_VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS}) +set(MITK_ITK_LIBRARY_DIRS ${ITK_LIBRARY_DIRS}) # variables containing link directories set(MITK_LIBRARY_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) set(MITK_LINK_DIRECTORIES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${ITK_LIBRARY_DIRS} ${VTK_LIBRARY_DIRS}) # Qt support if(MITK_USE_QT) find_package(Qt4 REQUIRED) set(QMITK_INCLUDE_DIRS ${MITK_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Qmitk ${PROJECT_BINARY_DIR}/CoreUI/Qmitk ) foreach(d QmitkApplicationBase QmitkModels QmitkPropertyObservers) list(APPEND QMITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Qmitk/${d}) endforeach() list(APPEND QMITK_INCLUDE_DIRS ${QWT_INCLUDE_DIR}) set(QMITK_LIBRARIES Qmitk ${MITK_LIBRARIES} ${QT_LIBRARIES}) set(QMITK_LINK_DIRECTORIES ${MITK_LINK_DIRECTORIES} ${QT_LIBRARY_DIR}) endif() if(MITK_BUILD_ALL_PLUGINS) set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL") endif() # create a list of types for template instantiations of itk image access functions function(_create_type_seq TYPES seq_var seqdim_var) set(_seq ) set(_seq_dim ) string(REPLACE "," ";" _pixeltypes "${TYPES}") foreach(_pixeltype ${_pixeltypes}) set(_seq "${_seq}(${_pixeltype})") set(_seq_dim "${_seq_dim}((${_pixeltype},dim))") endforeach() set(${seq_var} "${_seq}" PARENT_SCOPE) set(${seqdim_var} "${_seq_dim}" PARENT_SCOPE) endfunction() set(MITK_ACCESSBYITK_PIXEL_TYPES ) set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ ) set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ ) foreach(_type INTEGRAL FLOATING COMPOSITE) set(_typelist "${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES}") if(_typelist) if(MITK_ACCESSBYITK_PIXEL_TYPES) set(MITK_ACCESSBYITK_PIXEL_TYPES "${MITK_ACCESSBYITK_PIXEL_TYPES},${_typelist}") else() set(MITK_ACCESSBYITK_PIXEL_TYPES "${_typelist}") endif() endif() _create_type_seq("${_typelist}" MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ) set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ "${MITK_ACCESSBYITK_PIXEL_TYPES_SEQ}${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ}") set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ "${MITK_ACCESSBYITK_TYPES_DIMN_SEQ}${MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ}") endforeach() set(MITK_ACCESSBYITK_DIMENSIONS_SEQ ) string(REPLACE "," ";" _dimensions "${MITK_ACCESSBYITK_DIMENSIONS}") foreach(_dimension ${_dimensions}) set(MITK_ACCESSBYITK_DIMENSIONS_SEQ "${MITK_ACCESSBYITK_DIMENSIONS_SEQ}(${_dimension})") endforeach() diff --git a/CMakeLists.txt b/CMakeLists.txt index 17892f3fc5..32f8c96eb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,646 +1,638 @@ cmake_minimum_required(VERSION 2.8.2) #----------------------------------------------------------------------------- # Superbuild Option - Enabled by default #----------------------------------------------------------------------------- option(MITK_USE_SUPERBUILD "Build MITK and the projects it depends on via SuperBuild.cmake." ON) if(MITK_USE_SUPERBUILD) project(MITK-superbuild) set(MITK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) set(MITK_BINARY_DIR ${PROJECT_BINARY_DIR}) else() project(MITK) endif() #----------------------------------------------------------------------------- # See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details #----------------------------------------------------------------------------- set(project_policies CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. CMP0002 # NEW: Logical target names must be globally unique. CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths. CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace. CMP0005 # NEW: Preprocessor definition values are now escaped automatically. CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. CMP0007 # NEW: List command no longer ignores empty elements. CMP0008 # NEW: Libraries linked by full-path must have a valid library file name. CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default. CMP0010 # NEW: Bad variable reference syntax is an error. CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP. CMP0012 # NEW: if() recognizes numbers and boolean constants. CMP0013 # NEW: Duplicate binary directories are not allowed. CMP0014 # NEW: Input directories must have CMakeLists.txt ) foreach(policy ${project_policies}) if(POLICY ${policy}) cmake_policy(SET ${policy} NEW) endif() endforeach() #----------------------------------------------------------------------------- # Update CMake module path #------------------------------------------------------------------------------ set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- include(mitkMacroEmptyExternalProject) include(mitkFunctionGenerateProjectXml) #----------------------------------------------------------------------------- # Output directories. #----------------------------------------------------------------------------- foreach(type LIBRARY RUNTIME ARCHIVE) # Make sure the directory exists if(DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY AND NOT EXISTS ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}) message("Creating directory MITK_CMAKE_${type}_OUTPUT_DIRECTORY: ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}") file(MAKE_DIRECTORY "${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}") endif() if(MITK_USE_SUPERBUILD) set(output_dir ${MITK_BINARY_DIR}/bin) if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY) set(MITK_CMAKE_${type}_OUTPUT_DIRECTORY ${MITK_BINARY_DIR}/MITK-build/bin) endif() else() if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY) SET(output_dir ${MITK_BINARY_DIR}/bin) else() SET(output_dir ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}) endif() endif() set(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.") mark_as_advanced(CMAKE_${type}_OUTPUT_DIRECTORY) endforeach() #----------------------------------------------------------------------------- # Additional MITK Options (also shown during superbuild) #----------------------------------------------------------------------------- option(BUILD_SHARED_LIBS "Build MITK with shared libraries" ON) option(WITH_COVERAGE "Enable/Disable coverage" OFF) option(BUILD_TESTING "Test the project" ON) # some targets in Utilities also depend on Qt. Use this option # to decide if they should be build option(MITK_USE_QT "Use Trolltech's Qt library" ON) if(MITK_USE_QT) # find the package at the very beginning, so that QT4_FOUND is available find_package(Qt4 4.6.0 REQUIRED) endif() -option(MITK_INSTALL_RPATH_RELATIVE "Use relative rpath entries for installation packages" OFF) option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF) option(MITK_BUILD_TUTORIAL "Build the MITK tutorial" ON) option(MITK_USE_Boost "Use the Boost C++ library" OFF) option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON) option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY}) option(MITK_USE_DCMTK "EXEPERIMENTAL, superbuild only: Use DCMTK in MITK" OFF) option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF) -mark_as_advanced(MITK_INSTALL_RPATH_RELATIVE - MITK_BUILD_ALL_PLUGINS +mark_as_advanced(MITK_BUILD_ALL_PLUGINS MITK_USE_CTK MITK_USE_DCMTK ) set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES "int, unsigned int, short, unsigned short, char, unsigned char" CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros") set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES "double, float" CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros") set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES "" CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros") set(MITK_ACCESSBYITK_DIMENSIONS "2,3" CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros") mark_as_advanced(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES MITK_ACCESSBYITK_DIMENSIONS ) # consistency checks if(MITK_USE_BLUEBERRY AND NOT MITK_USE_CTK) MESSAGE(FATAL_ERROR "BlueBerry depends on CTK. Please set MITK_USE_CTK to ON.") endif() if(NOT MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES) set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES "int, unsigned int, short, unsigned short, char, unsigned char" CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE) endif() if(NOT MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES) set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES "double, float" CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE) endif() if(NOT MITK_ACCESSBYITK_DIMENSIONS) set(MITK_ACCESSBYITK_DIMENSIONS "2,3" CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros") endif() #----------------------------------------------------------------------------- # Additional CXX/C Flags #----------------------------------------------------------------------------- set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags") mark_as_advanced(ADDITIONAL_C_FLAGS) set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags") mark_as_advanced(ADDITIONAL_CXX_FLAGS) #----------------------------------------------------------------------------- # Project.xml #----------------------------------------------------------------------------- # A list of topologically ordered targets set(CTEST_PROJECT_SUBPROJECTS) if(MITK_USE_BLUEBERRY) list(APPEND CTEST_PROJECT_SUBPROJECTS BlueBerry) endif() list(APPEND CTEST_PROJECT_SUBPROJECTS MITK-Core MITK-CoreUI MITK-IGT MITK-ToF MITK-DTI MITK-Registration MITK-Modules # all modules not contained in a specific subproject MITK-Plugins # all plugins not contained in a specific subproject ) # Configure CTestConfigSubProject.cmake that could be used by CTest scripts configure_file(${MITK_SOURCE_DIR}/CTestConfigSubProject.cmake.in ${MITK_BINARY_DIR}/CTestConfigSubProject.cmake) if(CTEST_PROJECT_ADDITIONAL_TARGETS) # those targets will be executed at the end of the ctest driver script # and they also get their own subproject label set(subproject_list "${CTEST_PROJECT_SUBPROJECTS};${CTEST_PROJECT_ADDITIONAL_TARGETS}") else() set(subproject_list "${CTEST_PROJECT_SUBPROJECTS}") endif() # Generate Project.xml file expected by the CTest driver script mitkFunctionGenerateProjectXml(${MITK_BINARY_DIR} ${PROJECT_NAME} "${subproject_list}" ${MITK_USE_SUPERBUILD}) #----------------------------------------------------------------------------- # Superbuild script #----------------------------------------------------------------------------- if(MITK_USE_SUPERBUILD) include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake") return() endif() #***************************************************************************** #**************************** END OF SUPERBUILD **************************** #***************************************************************************** #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- include(mitkFunctionCheckCompilerFlags) include(mitkFunctionGetGccVersion) include(MacroParseArguments) include(mitkFunctionSuppressWarnings) # includes several functions include(mitkFunctionOrganizeSources) include(mitkFunctionGetVersion) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkMacroCreateModuleConf) include(mitkMacroCreateModule) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkFunctionAddCustomModuleTest) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) include(mitkMacroGetLinuxDistribution) #----------------------------------------------------------------------------- # Prerequesites #----------------------------------------------------------------------------- find_package(ITK REQUIRED) find_package(VTK REQUIRED) #----------------------------------------------------------------------------- # Set MITK specific options and variables (NOT available during superbuild) #----------------------------------------------------------------------------- # ASK THE USER TO SHOW THE CONSOLE WINDOW FOR CoreApp and ExtApp option(MITK_SHOW_CONSOLE_WINDOW "Use this to enable or disable the console window when starting MITK GUI Applications" ON) mark_as_advanced(MITK_SHOW_CONSOLE_WINDOW) # TODO: check if necessary option(USE_ITKZLIB "Use the ITK zlib for pic compression." ON) mark_as_advanced(USE_ITKZLIB) #----------------------------------------------------------------------------- # Get MITK version info #----------------------------------------------------------------------------- mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK) #----------------------------------------------------------------------------- # Installation preparation # # These should be set before any MITK install macros are used #----------------------------------------------------------------------------- -if(MITK_INSTALL_RPATH_RELATIVE) - set(CMAKE_INSTALL_RPATH ".") -else() - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin") -endif() - # on Mac OSX all BlueBerry plugins get copied into every # application bundle (.app directory) specified here if(APPLE) if(MITK_BUILD_org.mitk.gui.qt.extapplication) set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} ExtApp) endif() if(MITK_BUILD_org.mitk.gui.qt.application) set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} CoreApp) endif() endif(APPLE) #----------------------------------------------------------------------------- # Set symbol visibility Flags #----------------------------------------------------------------------------- # MinGW does not export all symbols automatically, so no need to set flags if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) set(VISIBILITY_CXX_FLAGS ) #"-fvisibility=hidden -fvisibility-inlines-hidden") endif() #----------------------------------------------------------------------------- # Set coverage Flags #----------------------------------------------------------------------------- if(WITH_COVERAGE) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG") set(COVERAGE_CXX_FLAGS ${coverage_flags}) set(COVERAGE_C_FLAGS ${coverage_flags}) endif() endif() #----------------------------------------------------------------------------- # MITK C/CXX Flags #----------------------------------------------------------------------------- set(MITK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}") set(MITK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}") if(CMAKE_COMPILER_IS_GNUCXX) set(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2") mitkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags) mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" cflags) mitkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION) # With older version of gcc supporting the flag -fstack-protector-all, an extra dependency to libssp.so # is introduced. If gcc is smaller than 4.4.0 and the build type is Release let's not include the flag. # Doing so should allow to build package made for distribution using older linux distro. if(${GCC_VERSION} VERSION_GREATER "4.4.0" OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${GCC_VERSION} VERSION_LESS "4.4.0")) mitkFunctionCheckCompilerFlags("-fstack-protector-all" cflags) endif() if(MINGW) # suppress warnings about auto imported symbols set(MITK_CXX_FLAGS "-Wl,--enable-auto-import ${MITK_CXX_FLAGS}") # we need to define a Windows version set(MITK_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${MITK_CXX_FLAGS}") endif() set(MITK_C_FLAGS "${cflags} ${MITK_C_FLAGS}") #set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${MITK_CXX_FLAGS}") set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wstrict-null-sentinel ${MITK_CXX_FLAGS}") endif() #----------------------------------------------------------------------------- # MITK Modules #----------------------------------------------------------------------------- set(MITK_MODULES_CONF_DIR ${MITK_BINARY_DIR}/modulesConf CACHE INTERNAL "Modules Conf") set(MITK_MODULES_PACKAGE_DEPENDS_DIR ${MITK_SOURCE_DIR}/CMake/PackageDepends) set(MODULES_PACKAGE_DEPENDS_DIRS ${MITK_MODULES_PACKAGE_DEPENDS_DIR}) #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if(BUILD_TESTING) enable_testing() include(CTest) mark_as_advanced(TCL_TCLSH DART_ROOT) option(MITK_ENABLE_GUI_TESTING OFF "Enable the MITK GUI tests") # Setup file for setting custom ctest vars configure_file( CMake/CTestCustom.cmake.in ${MITK_BINARY_DIR}/CTestCustom.cmake @ONLY ) # Configuration for the CMake-generated test driver set(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include ") set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN " try {") set(CMAKE_TESTDRIVER_AFTER_TESTMAIN " } catch( std::exception & excp ) { fprintf(stderr,\"%s\\n\",excp.what()); return EXIT_FAILURE; } catch( ... ) { printf(\"Exception caught in the test driver\\n\"); return EXIT_FAILURE; } ") set(MITK_TEST_OUTPUT_DIR "${MITK_BINARY_DIR}/test_output") if(NOT EXISTS ${MITK_TEST_OUTPUT_DIR}) file(MAKE_DIRECTORY ${MITK_TEST_OUTPUT_DIR}) endif() endif() configure_file(mitkTestingConfig.h.in ${MITK_BINARY_DIR}/mitkTestingConfig.h) #----------------------------------------------------------------------------- # MITK_SUPERBUILD_BINARY_DIR #----------------------------------------------------------------------------- # If MITK_SUPERBUILD_BINARY_DIR isn't defined, it means MITK is *NOT* build using Superbuild. # In that specific case, MITK_SUPERBUILD_BINARY_DIR should default to MITK_BINARY_DIR if(NOT DEFINED MITK_SUPERBUILD_BINARY_DIR) set(MITK_SUPERBUILD_BINARY_DIR ${MITK_BINARY_DIR}) endif() #----------------------------------------------------------------------------- # Compile Utilities and set-up MITK variables #----------------------------------------------------------------------------- add_subdirectory(Utilities) include(mitkSetupVariables) if(MITK_USE_BLUEBERRY) include(mitkSetupBlueBerry) endif() #----------------------------------------------------------------------------- # Set C/CXX Flags for MITK code #----------------------------------------------------------------------------- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MITK_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MITK_C_FLAGS}") if(MITK_USE_QT) add_definitions(-DQWT_DLL) endif() #----------------------------------------------------------------------------- # Add custom targets representing CDash subprojects #----------------------------------------------------------------------------- foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) if(NOT TARGET ${subproject}) add_custom_target(${subproject}) endif() endforeach() #----------------------------------------------------------------------------- # Add subdirectories #----------------------------------------------------------------------------- link_directories(${MITK_LINK_DIRECTORIES}) add_subdirectory(Core) if(MITK_USE_QT AND QT4_FOUND) add_subdirectory(CoreUI/Qmitk) endif() add_subdirectory(Modules) if(MITK_USE_BLUEBERRY) set(MITK_DEFAULT_SUBPROJECTS MITK-Plugins) include("${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Bundles/PluginList.cmake") set(mitk_core_plugins_fullpath ) foreach(core_plugin ${MITK_CORE_PLUGINS}) list(APPEND mitk_core_plugins_fullpath CoreUI/Bundles/${core_plugin}) endforeach() if(BUILD_TESTING) include(berryTestingHelpers) include("${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/BundleTesting/PluginList.cmake") set(mitk_core_test_plugins_fullpath ) foreach(core_test_plugin ${MITK_CORE_TEST_PLUGINS}) # list(APPEND mitk_core_test_plugins_fullpath CoreUI/BundleTesting/${core_test_plugin}) endforeach() set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp") get_target_property(_is_macosx_bundle CoreApp MACOSX_BUNDLE) if(APPLE AND _is_macosx_bundle) set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.app/Contents/MacOS/CoreApp") endif() set(BLUEBERRY_TEST_APP_ID "org.mitk.qt.application") endif() include("${CMAKE_CURRENT_SOURCE_DIR}/Modules/Bundles/PluginList.cmake") set(mitk_ext_plugins_fullpath ) foreach(ext_plugin ${MITK_EXT_PLUGINS}) list(APPEND mitk_ext_plugins_fullpath Modules/Bundles/${ext_plugin}) endforeach() ctkMacroSetupExternalPlugins(${mitk_core_plugins_fullpath} ${mitk_core_test_plugins_fullpath} ${mitk_ext_plugins_fullpath} BUILD_OPTION_PREFIX MITK_BUILD_ BUILD_ALL ${MITK_BUILD_ALL_PLUGINS} COMPACT_OPTIONS) ctkFunctionExtractPluginTargets("${mitk_core_plugins_fullpath}" ON MITK_CORE_ENABLED_PLUGINS) ctkFunctionExtractPluginTargets("${mitk_ext_plugins_fullpath}" ON MITK_EXT_ENABLED_PLUGINS) list(APPEND MITK_EXT_ENABLED_PLUGINS ${MITK_CORE_ENABLED_PLUGINS}) set(MITK_COREAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.provisioning") FunctionCreateProvisioningFile( FILE ${MITK_COREAPP_PROVISIONING_FILE} INCLUDE "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}" PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins" PLUGINS ${mitk_core_plugins_fullpath} ) set(MITK_EXTAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtApp.provisioning") FunctionCreateProvisioningFile( FILE ${MITK_EXTAPP_PROVISIONING_FILE} INCLUDE "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}" PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins" PLUGINS ${mitk_core_plugins_fullpath} ${mitk_ext_plugins_fullpath} ) set(MITK_PLUGIN_USE_FILE "${MITK_BINARY_DIR}/MitkPluginUseFile.cmake") ctkFunctionGeneratePluginUseFile(${MITK_PLUGIN_USE_FILE}) # Used in the export command further below GetMyTargetLibraries("${CTK_PLUGIN_LIBRARIES}" MITK_PLUGIN_TARGETS) # add legacy BlueBerry bundles add_subdirectory(Modules/Bundles) endif() # Construct a list of paths containing runtime directories # for MITK applications on Windows set(MITK_RUNTIME_PATH "${VTK_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${ITK_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/@VS_BUILD_TYPE@" ) if(QT4_FOUND) set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${QT_LIBRARY_DIR}/../bin") endif() if(MITK_USE_BLUEBERRY) set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CTK_RUNTIME_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/@VS_BUILD_TYPE@") endif() if(GDCM_DIR) set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${GDCM_DIR}/bin/@VS_BUILD_TYPE@") endif() if(OpenCV_DIR) set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${OpenCV_DIR}/bin/@VS_BUILD_TYPE@") endif() # DCMTK is statically build #if(DCMTK_DIR) # set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${DCMTK_DIR}/bin/@VS_BUILD_TYPE@") #endif() # Add applications directory add_subdirectory(Applications) #----------------------------------------------------------------------------- # Python Wrapping #----------------------------------------------------------------------------- set(MITK_WRAPPING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Wrapping) set(MITK_WRAPPING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Wrapping) option(MITK_USE_PYTHON "Build cswig Python wrapper support (requires CableSwig)." OFF) if(MITK_USE_PYTHON) add_subdirectory(Wrapping) endif() #----------------------------------------------------------------------------- # Documentation #----------------------------------------------------------------------------- add_subdirectory(Documentation) #----------------------------------------------------------------------------- # Installation #----------------------------------------------------------------------------- # set MITK cpack variables include(mitkSetupCPack) if(MITK_BUILD_org.mitk.gui.qt.application) list(APPEND CPACK_CREATE_DESKTOP_LINKS "CoreApp") endif() if(MITK_BUILD_org.mitk.gui.qt.extapplication) list(APPEND CPACK_CREATE_DESKTOP_LINKS "ExtApp") endif() configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in ${MITK_BINARY_DIR}/MITKCPackOptions.cmake @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${MITK_BINARY_DIR}/MITKCPackOptions.cmake") # include CPack model once all variables are set include(CPack) # Additional installation rules include(mitkInstallRules) #----------------------------------------------------------------------------- # Last configuration steps #----------------------------------------------------------------------------- set(MITK_EXPORTS_FILE "${MITK_BINARY_DIR}/MitkExports.cmake") file(REMOVE ${MITK_EXPORTS_FILE}) if(MITK_USE_BLUEBERRY) set(enabled_plugins ${BLUEBERRY_PLUGIN_TARGETS} ${MITK_PLUGIN_TARGETS} ${MITK_MODULES_ENABLED_PLUGINS} ) # This is for installation support of external projects depending on # MITK plugins. The export file should not be used for linking to MITK # libraries without using LINK_DIRECTORIES, since the exports are incomplete # yet(depending libraries are not exported). foreach(plugin ${enabled_plugins}) string(REPLACE "." "_" plugin_target ${plugin}) export(TARGETS ${plugin_target} APPEND FILE ${MITK_EXPORTS_FILE}) endforeach() endif() configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in ${MITK_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY) configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in ${MITK_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY) configure_file(${MITK_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in ${MITK_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY) configure_file(mitkVersion.h.in ${MITK_BINARY_DIR}/mitkVersion.h) configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h) set(VECMATH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/vecmath) set(IPFUNC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipFunc) set(UTILITIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities) configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h) configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY) # If we are under Windows, create two batch files which correctly # set up the environment for the application and for Visual Studio if(WIN32) include(mitkFunctionCreateWindowsBatchScript) set(VS_SOLUTION_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.sln") foreach(VS_BUILD_TYPE debug release) mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in" ${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat ${VS_BUILD_TYPE}) endforeach() endif(WIN32) diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt index 23a2b9d01a..04b1118b6d 100644 --- a/Documentation/CMakeLists.txt +++ b/Documentation/CMakeLists.txt @@ -1,158 +1,158 @@ # # Variables: # MITK_DOXYGEN_OUTPUT_DIR: doxygen output directory (optional) FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) OPTION(USE_DOT "Use dot program for generating graphical class diagrams with doxygen, if available" ON) OPTION(MITK_DOXYGEN_BUILD_ALWAYS "Always build the MITK documentation when building the default target" OFF) OPTION(MITK_DOXYGEN_GENERATE_QCH_FILES "Use doxygen to generate Qt compressed help files for MITK docs" OFF) MARK_AS_ADVANCED(USE_DOT MITK_DOXYGEN_BUILD_ALWAYS MITK_DOXYGEN_GENERATE_QCH_FILES) SET(HAVE_DOT "NO") IF(DOXYGEN_DOT_EXECUTABLE AND USE_DOT) SET(HAVE_DOT "YES") ENDIF() SET(MITK_DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Documentation/Doxygen CACHE PATH "Output directory for doxygen generated documentation." ) SET(MITK_DOXYGEN_TAGFILE_NAME ${MITK_DOXYGEN_OUTPUT_DIR}/MITK.tag CACHE INTERNAL "MITK Doxygen tag file") # Create QCH files for MITK and external projects SET(MITK_DOXYGEN_GENERATE_QHP "NO") IF(MITK_DOXYGEN_GENERATE_QCH_FILES) FIND_PROGRAM(QT_HELPGENERATOR_EXECUTABLE NAMES qhelpgenerator qhelpgenerator-qt4 qhelpgenerator4 PATHS ${QT_BINARY_DIR} DOC "The location of the the Qt help generator executable" NO_DEFAULT_PATH ) MARK_AS_ADVANCED(QT_HELPGENERATOR_EXECUTABLE) IF(NOT QT_HELPGENERATOR_EXECUTABLE) MESSAGE(SEND_ERROR "The Qt help generator could not be found. Disabling qch generation") ELSE() SET(MITK_DOXYGEN_GENERATE_QHP "YES") ENDIF() # The name of the generated MITK qch file, relative to the # Doxygen HTML output folder - SET(MITK_DOXYGEN_QCH_FILE "../MITK-${MITK_WC_REVISION_HASH}.qch") + SET(MITK_DOXYGEN_QCH_FILE "../MITK-${MITK_REVISION_ID}.qch") # Generating ITK and VTK docs it not done yet #OPTION(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE "Use doxygen to generate a Qt compressed help file for VTK docs" OFF) #OPTION(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE "Use doxygen to generate a Qt compressed help file for ITK docs" OFF) #MARK_AS_ADVANCED(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE MITK_DOXYGEN_GENERATE_ITK_QCH_FILE) ENDIF() IF(MITK_USE_BLUEBERRY) FILE(RELATIVE_PATH _blueberry_doxygen_path ${MITK_DOXYGEN_OUTPUT_DIR}/html ${BLUEBERRY_DOXYGEN_OUTPUT_DIR}/html) SET(BLUEBERRY_DOXYGEN_TAGFILE "${BLUEBERRY_DOXYGEN_TAGFILE_NAME}=${_blueberry_doxygen_path}") SET(BLUEBERRY_DOXYGEN_LINK "BlueBerry Documentation") SET(MITK_XP_LINK "\\ref mitkExtPointsIndex") CONFIGURE_FILE(schema.css ${MITK_DOXYGEN_OUTPUT_DIR}/html/schema.css) SET(MITK_DOXYGEN_ENABLED_SECTIONS "${MITK_DOXYGEN_ENABLED_SECTIONS} BLUEBERRY") ENDIF(MITK_USE_BLUEBERRY) # Compile a doxygen input filter for processing CMake scripts INCLUDE(mitkFunctionCMakeDoxygenFilterCompile) mitkFunctionCMakeDoxygenFilterCompile(NAMESPACE "CMake") # Configure some doxygen options IF(NOT MITK_DOXYGEN_GENERATE_TODOLIST) SET(MITK_DOXYGEN_GENERATE_TODOLIST "NO") ENDIF() IF(NOT MITK_DOXYGEN_GENERATE_BUGLIST) SET(MITK_DOXYGEN_GENERATE_BUGLIST "NO") ENDIF() IF(NOT MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS) SET(MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS "NO") ENDIF() IF(NOT MITK_DOXYGEN_UML_LOOK) SET(MITK_DOXYGEN_UML_LOOK "NO") ENDIF() IF(NOT MITK_DOXYGEN_GENERATE_DEPRECATEDLIST) SET(MITK_DOXYGEN_GENERATE_DEPRECATEDLIST "YES") ENDIF() IF(NOT DEFINED MITK_DOXYGEN_DOT_NUM_THREADS) SET(MITK_DOXYGEN_DOT_NUM_THREADS 0) ENDIF() CONFIGURE_FILE(Doxygen/MainPage.dox.in ${CMAKE_CURRENT_BINARY_DIR}/Doxygen/MainPage.dox) CONFIGURE_FILE(doxygen.conf.in ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf) IF(MITK_DOXYGEN_BUILD_ALWAYS) SET(_doc_in_all "ALL") ELSE() SET(_doc_in_all "") ENDIF() ADD_CUSTOM_TARGET(doc ${_doc_in_all} ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf ) IF (MITK_USE_BLUEBERRY) # convert the extension points schema files into html FIND_PACKAGE(Ant) IF(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR) LIST(APPEND MITK_XP_GLOB_EXPRESSIONS ${MITK_SOURCE_DIR}/CoreUI/Bundles/plugin.xml ${MITK_SOURCE_DIR}/Modules/Bundles/plugin.xml) FILE(GLOB_RECURSE _plugin_xmls ${MITK_XP_GLOB_EXPRESSIONS}) MACRO_CONVERT_SCHEMA(INPUT ${_plugin_xmls} OUTPUT_DIR "${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html" TARGET_NAME mitkXPDoc ) ADD_DEPENDENCIES(doc mitkXPDoc) IF(${PROJECT_NAME} STREQUAL "MITK") ADD_DEPENDENCIES(doc BlueBerryDoc) ENDIF() ENDIF(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR) ENDIF (MITK_USE_BLUEBERRY) #IF(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE) # # add the command to generate the ITK documantation # ADD_CUSTOM_TARGET(doc-itk # COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.itk.conf) # ADD_DEPENDENCIES(doc doc-itk) #ENDIF() #IF(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE) # # add the command to generate the VTK documantation # ADD_CUSTOM_TARGET(doc-vtk # COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.vtk.conf) # ADD_DEPENDENCIES(doc doc-vtk) #ENDIF() ELSE(DOXYGEN_FOUND) # copy blank documentation page to prevent QtHelp from being shown # copy the .qhc and .qch files to $MITK_BIN/mitk/bin/ExtBundles/resources/ CONFIGURE_FILE(pregenerated/MITKBlankPage.qch ${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MITKBlankPage.qch COPYONLY) CONFIGURE_FILE(pregenerated/MitkExtQtHelpCollection.qhc ${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MitkExtQtHelpCollection.qhc COPYONLY) ENDIF(DOXYGEN_FOUND) diff --git a/MITKConfig.cmake.in b/MITKConfig.cmake.in index 4d1fbffdb4..0203523c26 100644 --- a/MITKConfig.cmake.in +++ b/MITKConfig.cmake.in @@ -1,131 +1,132 @@ # Update the CMake module path SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@MITK_SOURCE_DIR@/CMake") # Include MITK macros include(MacroParseArguments) include(mitkFunctionOrganizeSources) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkMacroCreateModuleConf) include(mitkMacroCreateModule) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkFunctionAddCustomModuleTest) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) +include(mitkMacroCreateCTKPlugin) # The MITK version number SET(MITK_VERSION_MAJOR "@MITK_VERSION_MAJOR@") SET(MITK_VERSION_MINOR "@MITK_VERSION_MINOR@") SET(MITK_VERSION_PATCH "@MITK_VERSION_PATCH@") # MITK specific variables SET(MITK_SOURCE_DIR "@MITK_SOURCE_DIR@") SET(MITK_BINARY_DIR "@MITK_BINARY_DIR@") SET(UTILITIES_DIR "@UTILITIES_DIR@") SET(REGISTER_QFUNCTIONALITY_CPP_IN "@REGISTER_QFUNCTIONALITY_CPP_IN@") SET(MITK_MODULES_CONF_DIR "@MITK_MODULES_CONF_DIR@") SET(MITK_MODULES_PACKAGE_DEPENDS_DIR "@MITK_MODULES_PACKAGE_DEPENDS_DIR@") SET(MODULES_PACKAGE_DEPENDS_DIRS "@MODULES_PACKAGE_DEPENDS_DIRS@") SET(MITK_DOXYGEN_TAGFILE_NAME "@MITK_DOXYGEN_TAGFILE_NAME@") # Include directory variables SET(MITK_INCLUDE_DIRS "@MITK_INCLUDE_DIRS@") SET(QMITK_INCLUDE_DIRS "@QMITK_INCLUDE_DIRS@") SET(ANN_INCLUDE_DIR "@ANN_INCLUDE_DIR@") SET(IPSEGMENTATION_INCLUDE_DIR "@IPSEGMENTATION_INCLUDE_DIR@") SET(VECMATH_INCLUDE_DIR "@VECMATH_INCLUDE_DIR@") SET(IPFUNC_INCLUDE_DIR "@IPFUNC_INCLUDE_DIR@") SET(MITK_IGT_INCLUDE_DIRS "@MITK_IGT_INCLUDE_DIRS@") # Library variables SET(MITK_LIBRARIES "@MITK_LIBRARIES@") SET(QMITK_LIBRARIES "@QMITK_LIBRARIES@") # Link directory variables SET(MITK_LINK_DIRECTORIES "@MITK_LINK_DIRECTORIES@") SET(QMITK_LINK_DIRECTORIES "@QMITK_LINK_DIRECTORIES@") SET(MITK_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@/plugins") -SET(MITK_VTK_LIBRARY_DIRS "@VTK_LIBRARY_DIRS@") -SET(MITK_ITK_LIBRARY_DIRS "@ITK_LIBRARY_DIRS@") +SET(MITK_VTK_LIBRARY_DIRS "@MITK_VTK_LIBRARY_DIRS@") +SET(MITK_ITK_LIBRARY_DIRS "@MITK_ITK_LIBRARY_DIRS@") # External projects SET(ITK_DIR "@ITK_DIR@") SET(VTK_DIR "@VTK_DIR@") SET(DCMTK_DIR "@DCMTK_DIR@") SET(GDCM_DIR "@GDCM_DIR@") SET(BOOST_ROOT "@BOOST_ROOT@") SET(OpenCV_DIR "@OpenCV_DIR@") SET(MITK_QMAKE_EXECUTABLE "@QT_QMAKE_EXECUTABLE@") SET(MITK_DATA_DIR "@MITK_DATA_DIR@") SET(MITK_RUNTIME_PATH "@MITK_RUNTIME_PATH@") # MITK use variables SET(MITK_USE_QT @MITK_USE_QT@) SET(MITK_USE_BLUEBERRY @MITK_USE_BLUEBERRY@) SET(MITK_USE_Boost @MITK_USE_Boost@) SET(MITK_USE_CTK @MITK_USE_CTK@) SET(MITK_USE_DCMTK @MITK_USE_DCMTK@) SET(MITK_USE_OpenCV @MITK_USE_OpenCV@) # There is no PocoConfig.cmake, so we set Poco specific CMake variables # here. This way the call to FIND_PACKAGE(Poco) in BlueBerryConfig.cmake # finds the Poco distribution supplied by MITK SET(Poco_INCLUDE_DIR "@MITK_SOURCE_DIR@/Utilities/Poco") SET(Poco_LIBRARY_DIR "@MITK_BINARY_DIR@/bin") IF(MITK_USE_IGT) #INCLUDE(${MITK_DIR}/mitkIGTConfig.cmake) ENDIF() IF(NOT MITK_EXPORTS_FILE_INCLUDED) IF(EXISTS "@MITK_EXPORTS_FILE@") SET(MITK_EXPORTS_FILE_INCLUDED 1) INCLUDE("@MITK_EXPORTS_FILE@") ENDIF(EXISTS "@MITK_EXPORTS_FILE@") ENDIF() # BlueBerry support IF(MITK_USE_BLUEBERRY) SET(BlueBerry_DIR "@MITK_BINARY_DIR@/BlueBerry") INCLUDE(mitkMacroCreatePlugin) IF(NOT MITK_SKIP_BUNDLELIST) IF(MITK_USE_EXT) INCLUDE("@MITK_BINARY_DIR@/Bundles/MITKModulesBundleList.cmake") ENDIF() ENDIF(NOT MITK_SKIP_BUNDLELIST) # Don't include the BlueBerry exports file, since the targets are # also exported in the MITK exports file SET(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1) FIND_PACKAGE(BlueBerry) IF(NOT BlueBerry_FOUND) MESSAGE(SEND_ERROR "MITK does not seem to be configured with BlueBerry support. Set MITK_USE_BLUEBERRY to ON in your MITK build configuration.") ENDIF(NOT BlueBerry_FOUND) SET(MITK_PLUGIN_SOURCE_DIRS "@MITK_SOURCE_DIR@/Bundles") SET(MITK_PLUGIN_OUTPUT_DIRS ) IF(MITK_USE_EXT) LIST(APPEND MITK_PLUGIN_OUTPUT_DIRS @MITK_MODULES_PLUGIN_OUTPUT_DIRS@) ENDIF() INCLUDE("@MITK_PLUGIN_USE_FILE@") #SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} @MITK_PLUGIN_TARGETS@) SET(MITK_PLUGIN_PROVISIONING_FILE "@MITK_EXTAPP_PROVISIONING_FILE@") SET(MITK_PROVISIONING_FILES "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}" "${MITK_PLUGIN_PROVISIONING_FILE}") ENDIF(MITK_USE_BLUEBERRY) diff --git a/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake b/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake index 69f823e5e5..856fec09f8 100644 --- a/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake @@ -1,52 +1,52 @@ SET(SRC_CPP_FILES QmitkExtApplication.cpp QmitkExtAppWorkbenchAdvisor.cpp ) SET(INTERNAL_CPP_FILES QmitkExtApplicationPlugin.cpp QmitkExtDefaultPerspective.cpp ) SET(MOC_H_FILES src/QmitkExtApplication.h src/internal/QmitkExtApplicationPlugin.h src/internal/QmitkExtDefaultPerspective.h ) SET(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml resources/icon_research.xpm ) SET(QRC_FILES # uncomment the following line if you want to use Qt resources resources/QmitkExtApplication.qrc ) SET(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) SET(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) #----------- Qt Help Collection Project -------------# IF (BLUEBERRY_USE_QT_HELP) SET(_plugin_qhcp_input "${CMAKE_CURRENT_SOURCE_DIR}/documentation/MitkExtQtHelpCollectionProject.qhcp") - SET(_plugin_qhcp_output "${CMAKE_CURRENT_BINARY_DIR}/MitkExtQtHelpCollection_${MITK_WC_REVISION_HASH}.qhc") + SET(_plugin_qhcp_output "${CMAKE_CURRENT_BINARY_DIR}/MitkExtQtHelpCollection_${MITK_REVISION_ID}.qhc") ADD_CUSTOM_COMMAND(OUTPUT ${_plugin_qhcp_output} COMMAND ${QT_COLLECTIONGENERATOR_EXECUTABLE} ${_plugin_qhcp_input} -o ${_plugin_qhcp_output} DEPENDS ${_plugin_qhcp_input} ) LIST(APPEND CACHED_RESOURCE_FILES ${_plugin_qhcp_output}) ENDIF() diff --git a/SuperBuild.cmake b/SuperBuild.cmake index d755e98569..bcd0de84de 100644 --- a/SuperBuild.cmake +++ b/SuperBuild.cmake @@ -1,249 +1,248 @@ #----------------------------------------------------------------------------- # Convenient macro allowing to download a file #----------------------------------------------------------------------------- MACRO(downloadFile url dest) FILE(DOWNLOAD ${url} ${dest} STATUS status) LIST(GET status 0 error_code) LIST(GET status 1 error_msg) IF(error_code) MESSAGE(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}") ENDIF() ENDMACRO() #----------------------------------------------------------------------------- # MITK Prerequisites #----------------------------------------------------------------------------- #----------------------------- Qt --------------------------- if(MITK_USE_QT) find_package(Qt4 REQUIRED) set(vtk_QT_ARGS -DDESIRED_QT_VERSION:STRING=4 -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_USE_QVTK_QTOPENGL:BOOL=ON -DVTK_USE_QT:BOOL=ON -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} ) endif() #----------------------------------------------------------------------------- # External project settings #----------------------------------------------------------------------------- INCLUDE(ExternalProject) SET(ep_base "${CMAKE_BINARY_DIR}/CMakeExternals") SET_PROPERTY(DIRECTORY PROPERTY EP_BASE ${ep_base}) SET(ep_install_dir ${ep_base}/Install) #SET(ep_build_dir ${ep_base}/Build) SET(ep_source_dir ${ep_base}/Source) #SET(ep_parallelism_level) SET(ep_build_shared_libs ON) SET(ep_build_testing OFF) # Compute -G arg for configuring external projects with the same CMake generator: IF(CMAKE_EXTRA_GENERATOR) SET(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") ELSE() SET(gen "${CMAKE_GENERATOR}") ENDIF() # Use this value where semi-colons are needed in ep_add args: set(sep "^^") ## IF(MSVC90 OR MSVC10) SET(ep_common_C_FLAGS "${CMAKE_C_FLAGS} /bigobj /MP") SET(ep_common_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP") ELSE() SET(ep_common_C_FLAGS "${CMAKE_C_FLAGS} -DLINUX_EXTRA") SET(ep_common_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX_EXTRA") ENDIF() SET(ep_common_args -DBUILD_TESTING:BOOL=${ep_build_testing} -DCMAKE_INSTALL_PREFIX:PATH=${ep_install_dir} -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_C_FLAGS:STRING=${ep_common_C_FLAGS} -DCMAKE_CXX_FLAGS:STRING=${ep_common_CXX_FLAGS} #debug flags -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} #release flags -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} #relwithdebinfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} ) #----------------------------------------------------------------------------- # ExternalProjects #----------------------------------------------------------------------------- SET(external_projects VTK GDCM ITK Boost DCMTK CTK OpenCV MITKData ) # Include external projects FOREACH(p ${external_projects}) INCLUDE(CMakeExternals/${p}.cmake) ENDFOREACH() #----------------------------------------------------------------------------- # Set superbuild boolean args #----------------------------------------------------------------------------- SET(mitk_cmake_boolean_args BUILD_SHARED_LIBS WITH_COVERAGE BUILD_TESTING MITK_USE_QT - MITK_INSTALL_RPATH_RELATIVE MITK_BUILD_ALL_PLUGINS MITK_BUILD_TUTORIAL MITK_USE_Boost MITK_USE_BLUEBERRY MITK_USE_CTK MITK_USE_DCMTK MITK_USE_OpenCV ) #----------------------------------------------------------------------------- # Generate cmake variable names for MITK bundles #----------------------------------------------------------------------------- INCLUDE(mitkSuperBuildPlugins) FOREACH(plugin ${MITK_SUPERBUILD_PLUGINS}) LIST(APPEND mitk_cmake_boolean_args MITK_BUILD_${plugin}) OPTION(MITK_BUILD_${plugin} "Build the MITK ${plugin} plugin" OFF) ENDFOREACH() #----------------------------------------------------------------------------- # Create the final variable containing superbuild boolean args #----------------------------------------------------------------------------- SET(mitk_superbuild_boolean_args) FOREACH(mitk_cmake_arg ${mitk_cmake_boolean_args}) LIST(APPEND mitk_superbuild_boolean_args -D${mitk_cmake_arg}:BOOL=${${mitk_cmake_arg}}) ENDFOREACH() IF(MITK_BUILD_ALL_PLUGINS) LIST(APPEND mitk_superbuild_boolean_args -DBLUEBERRY_BUILD_ALL_PLUGINS:BOOL=ON) ENDIF() #----------------------------------------------------------------------------- # MITK Utilities #----------------------------------------------------------------------------- set(proj MITK-Utilities) ExternalProject_Add(${proj} DOWNLOAD_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS # Mandatory dependencies ${VTK_DEPENDS} ${ITK_DEPENDS} # Optionnal dependencies ${Boost_DEPENDS} ${CTK_DEPENDS} ${DCMTK_DEPENDS} ${OpenCV_DEPENDS} ${MITK-Data_DEPENDS} ) #----------------------------------------------------------------------------- # MITK Configure #----------------------------------------------------------------------------- IF(MITK_INITIAL_CACHE_FILE) SET(mitk_initial_cache_arg -C "${MITK_INITIAL_CACHE_FILE}") ENDIF() SET(proj MITK-Configure) STRING(REPLACE ";" "^^" MITK_MODULES_TO_BUILD_PARAM "${MITK_MODULES_TO_BUILD}") MESSAGE("PARAM: ${MITK_MODULES_TO_BUILD_PARAM}") ExternalProject_Add(${proj} LIST_SEPARATOR ^^ DOWNLOAD_COMMAND "" CMAKE_GENERATOR ${gen} CMAKE_ARGS ${ep_common_args} ${mitk_superbuild_boolean_args} -DMITK_USE_SUPERBUILD:BOOL=OFF -DMITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DMITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DMITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS} -DMITK_SUPERBUILD_BINARY_DIR:PATH=${MITK_BINARY_DIR} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DMITK_KWSTYLE_EXECUTABLE:FILEPATH=${MITK_KWSTYLE_EXECUTABLE} -DMITK_MODULES_TO_BUILD:INTERNAL=${MITK_MODULES_TO_BUILD_PARAM} -DCTK_DIR:PATH=${CTK_DIR} -DDCMTK_DIR:PATH=${DCMTK_DIR} -DVTK_DIR:PATH=${VTK_DIR} # FindVTK expects VTK_DIR -DITK_DIR:PATH=${ITK_DIR} # FindITK expects ITK_DIR -DOpenCV_DIR:PATH=${OpenCV_DIR} -DGDCM_DIR:PATH=${GDCM_DIR} -DBOOST_ROOT:PATH=${BOOST_ROOT} -DMITK_DATA_DIR:PATH=${MITK_DATA_DIR} -DMITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES} -DMITK_ACCESSBYITK_FLOATING_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES} -DMITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES} -DMITK_ACCESSBYITK_DIMENSIONS:STRING=${MITK_ACCESSBYITK_DIMENSIONS} ${mitk_initial_cache_arg} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} BINARY_DIR ${CMAKE_BINARY_DIR}/MITK-build BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS MITK-Utilities ) #----------------------------------------------------------------------------- # MITK #----------------------------------------------------------------------------- #MESSAGE(STATUS SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:${SUPERBUILD_EXCLUDE_MITKBUILD_TARGET}) IF(NOT DEFINED SUPERBUILD_EXCLUDE_MITKBUILD_TARGET OR NOT SUPERBUILD_EXCLUDE_MITKBUILD_TARGET) SET(proj MITK-build) ExternalProject_Add(${proj} DOWNLOAD_COMMAND "" CMAKE_GENERATOR ${gen} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} BINARY_DIR MITK-build INSTALL_COMMAND "" DEPENDS "MITK-Configure" ) ENDIF() #----------------------------------------------------------------------------- # Custom target allowing to drive the build of MITK project itself #----------------------------------------------------------------------------- ADD_CUSTOM_TARGET(MITK COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/MITK-build WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MITK-build ) diff --git a/mitkVersion.h.in b/mitkVersion.h.in index ae0b3e454f..22e09c05bf 100644 --- a/mitkVersion.h.in +++ b/mitkVersion.h.in @@ -1,8 +1,8 @@ /* mitkVersion.h this file is generated. Do not change! */ -#define MITK_REVISION "@MITK_WC_REVISION_HASH@" -#define MITK_REVISION_NAME "@MITK_WC_REVISION_NAME@" +#define MITK_REVISION "@MITK_REVISION_ID@" +#define MITK_REVISION_NAME "@MITK_REVISION_NAME@"