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/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/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/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/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@"