diff --git a/Applications/AppList.cmake b/Applications/AppList.cmake index 64eb3f28fd..c965a86005 100644 --- a/Applications/AppList.cmake +++ b/Applications/AppList.cmake @@ -1,20 +1,22 @@ # This file is included in the top-level MITK CMakeLists.txt file to # allow early dependency checking option(MITK_BUILD_APP_CoreApp "Build the MITK CoreApp" OFF) option(MITK_BUILD_APP_ExtApp "Build the MITK ExtApp" ON) +option(MITK_BUILD_APP_mitkDiffusion "Build MITK Diffusion executable" OFF) # This variable is fed to ctkFunctionSetupPlugins() macro in the # top-level MITK CMakeLists.txt file. This allows to automatically # enable required plug-in runtime dependencies for applications using # the CTK DGraph executable and the ctkMacroValidateBuildOptions macro. # For this to work, directories containing executables must contain # a CMakeLists.txt file containing a "project(...)" command and a # target_libraries.cmake file setting a list named "target_libraries" # with required plug-in target names. set(MITK_APPS CoreApp^^MITK_BUILD_APP_CoreApp ExtApp^^MITK_BUILD_APP_ExtApp + mitkDiffusion^^MITK_BUILD_APP_mitkDiffusion ) diff --git a/Applications/CMakeLists.txt b/Applications/CMakeLists.txt index 5f79c2973f..8e4124be00 100644 --- a/Applications/CMakeLists.txt +++ b/Applications/CMakeLists.txt @@ -1,23 +1,27 @@ set(MITK_CPACK_PACKAGE_EXECUTABLES "" CACHE INTERNAL "Collecting windows shortcuts to executables" FORCE) set(MITK_DIR ${PROJECT_BINARY_DIR}) set(MITK_EXPORTS_FILE_INCLUDED 1) if(MITK_USE_QT AND QT4_FOUND) if(MITK_USE_CTK) add_subdirectory(PluginGenerator) endif() if(MITK_BUILD_APP_CoreApp OR MITK_BUILD_ALL_APPS) add_subdirectory(CoreApp) endif() if(MITK_BUILD_APP_ExtApp OR MITK_BUILD_ALL_APPS) add_subdirectory(ExtApp) endif() if(MITK_BUILD_TUTORIAL) add_subdirectory(Tutorial) endif() + + if(MITK_BUILD_APP_mitkDiffusion OR MITK_BUILD_ALL_APPS) + add_subdirectory(mitkDiffusion) + endif() endif() diff --git a/Applications/mitkDiffusion/CMakeLists.txt b/Applications/mitkDiffusion/CMakeLists.txt new file mode 100644 index 0000000000..76b5b46354 --- /dev/null +++ b/Applications/mitkDiffusion/CMakeLists.txt @@ -0,0 +1,59 @@ +project(mitkDiffusion) + +set(DIFFUSIONAPP_NAME mitkDiffusion) + +set(_app_options) +if(MITK_SHOW_CONSOLE_WINDOW) + list(APPEND _app_options SHOW_CONSOLE) +endif() + +MITK_USE_MODULE(qtsingleapplication) +include_directories(${ALL_INCLUDE_DIRECTORIES}) + +# Create a cache entry for the provisioning file which is used to export +# the file name in the MITKConfig.cmake file. This will keep external projects +# which rely on this file happy. +set(DIFFUSIONIMAGINGAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DIFFUSIONAPP_NAME}.provisioning" CACHE INTERNAL "${DIFFUSIONAPP_NAME} provisioning file" FORCE) + +set(_plugins + org.blueberry.compat + org.blueberry.ui.qt.help + org.mitk.diffusionimaging + org.mitk.gui.qt.diffusionimagingapp + org.mitk.gui.qt.common.legacy + org.mitk.gui.qt.ext + org.mitk.gui.qt.datamanager + org.mitk.gui.qt.measurementtoolbox + org.mitk.gui.qt.segmentation + org.mitk.gui.qt.volumevisualization + org.mitk.gui.qt.diffusionimaging + org.mitk.gui.qt.imagenavigator + org.mitk.gui.qt.moviemaker + org.mitk.planarfigure +) + +# Plug-ins listed below will not be +# - added as a build-time dependency to the executable +# - listed in the provisioning file for the executable +# - installed if they are external plug-ins + +set(_exclude_plugins + org.blueberry.test + org.blueberry.uitest + org.mitk.gui.qt.coreapplication + org.mitk.gui.qt.extapplication +) + +FunctionCreateBlueBerryApplication( + NAME ${DIFFUSIONAPP_NAME} + DESCRIPTION "MITK Diffusion" + PLUGINS ${_plugins} + EXCLUDE_PLUGINS ${_exclude_plugins} + LINK_LIBRARIES ${ALL_LIBRARIES} + ${_app_options} +) + +# Add a build time dependency to legacy BlueBerry bundles. +if(MITK_MODULES_ENABLED_PLUGINS) + add_dependencies(${DIFFUSIONAPP_NAME} ${MITK_MODULES_ENABLED_PLUGINS}) +endif() \ No newline at end of file diff --git a/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.cpp b/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.cpp new file mode 100644 index 0000000000..f3d02621d5 --- /dev/null +++ b/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.cpp @@ -0,0 +1,91 @@ + +#include "QDiffusionImagingSplashScreen.h" +#include +#include + +QDiffusionImagingSplashScreen::QDiffusionImagingSplashScreen(const QImage& image, QWidget* parent) +:QWidget(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::SplashScreen ) +,backgroundImage(image) +{ + setAttribute(Qt::WA_TranslucentBackground); + resize(image.size()); + resizeEvent(NULL); +} + +QDiffusionImagingSplashScreen::~QDiffusionImagingSplashScreen() +{ +} + +QSize QDiffusionImagingSplashScreen::sizeHint() const +{ + return backgroundImage.size(); +} + +void QDiffusionImagingSplashScreen::paintEvent(QPaintEvent*) +{ + QPainter painter(this); + painter.drawImage( rect(), backgroundImage ); +} + +void QDiffusionImagingSplashScreen::resizeEvent(QResizeEvent*) +{ + setMask( createMaskRegion( backgroundImage) ); +} + +QRegion QDiffusionImagingSplashScreen::createMaskRegion( const QImage & image, bool posMask ) +{ + if ( image.isNull() ) return QRegion(); + + if (image.depth() != 32) + { + QImage img32 = image.convertToFormat(QImage::Format_RGB32); + return createMaskRegion( img32, posMask ); + } + + int width = image.width(); + int height = image.height(); + QRegion retVal; + + for( int y = 0; y < height; ++y ) + { + // guarented to be 32 bit by the check above + QRgb *currLine = (QRgb *)image.scanLine( y ); + int xstart = -1; + int xcurr = -1; + QRgb * currVal = currLine; + for( int x = 0; x < width; ++x, ++currVal ) + { + int alpha = qAlpha( *currVal ); + if ( ( posMask && alpha != 0 ) || ( !posMask && alpha == 0 ) ) + { + // on non-alpha pixel + if ( xstart == -1 ) + { + // remember start of non-alpha line-segment (if necessary) + xstart = x; + } + xcurr = x; + } + else // alpha-pixel + if ( xcurr != -1 ) // if this alpha pixel is following a non-alpha line-segment + { + retVal += QRegion( xstart, y, xcurr - xstart + 1, 1 ); + xstart = -1; + xcurr = -1; + } + } + if ( xcurr != -1 ) + { + retVal += QRegion( xstart, y, xcurr - xstart + 1, 1 ); + } + } + + return retVal; +} + +void QDiffusionImagingSplashScreen::mouseReleaseEvent(QMouseEvent* mouseEvent) +{ + QWidget::mouseReleaseEvent(mouseEvent); + hide(); +} + diff --git a/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.h b/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.h new file mode 100644 index 0000000000..5871e94257 --- /dev/null +++ b/Applications/mitkDiffusion/QDiffusionImagingSplashScreen.h @@ -0,0 +1,47 @@ +/*========================================================================= + +Program: Medical Imaging & Interaction Toolkit +Module: $RCSfile: mitkPropertyManager.cpp,v $ +Language: C++ +Date: $Date$ +Version: $Revision: 1.12 $ + +Copyright (c) German Cancer Research Center, Division of Medical and +Biological Informatics. All rights reserved. +See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef QDiffusionImagingSplashScreen_h_included +#define QDiffusionImagingSplashScreen_h_included + +#include +#include + +class QDiffusionImagingSplashScreen : public QWidget +{ + Q_OBJECT + + public: + + QDiffusionImagingSplashScreen(const QImage& image, QWidget* parent = 0); + ~QDiffusionImagingSplashScreen(); + virtual QSize sizeHint() const; + + protected: + + virtual void paintEvent(QPaintEvent* paintEvent); + virtual void resizeEvent(QResizeEvent* resizeEvent); + virtual void mouseReleaseEvent(QMouseEvent* mouseEvent); + + QRegion createMaskRegion( const QImage & image, bool posMask = true ); + + QImage backgroundImage; +}; + +#endif + diff --git a/Applications/mitkDiffusion/mitkDiffusion.cpp b/Applications/mitkDiffusion/mitkDiffusion.cpp new file mode 100644 index 0000000000..22049b5439 --- /dev/null +++ b/Applications/mitkDiffusion/mitkDiffusion.cpp @@ -0,0 +1,136 @@ +/*========================================================================= + +Program: Medical Imaging & Interaction Toolkit +Module: $RCSfile$ +Language: C++ +Date: $Date$ +Version: $Revision: 13820 $ + +Copyright (c) German Cancer Research Center, Division of Medical and +Biological Informatics. All rights reserved. +See MITKCopyright.txt or http://www.mitk.org/ for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +class QtSafeApplication : public QtSingleApplication +{ + +public: + + QtSafeApplication(int& argc, char** argv) : QtSingleApplication(argc, argv) + {} + + /** + * Reimplement notify to catch unhandled exceptions and open an error message. + * + * @param receiver + * @param event + * @return + */ + bool notify(QObject* receiver, QEvent* event) + { + QString msg; + try + { + return QApplication::notify(receiver, event); + } + catch (Poco::Exception& e) + { + msg = QString::fromStdString(e.displayText()); + } + catch (std::exception& e) + { + msg = e.what(); + } + catch (...) + { + msg = "Unknown exception"; + } + + QString text("An error occurred. You should save all data and quit the program to " + "prevent possible data loss.\nSee the error log for details.\n\n"); + text += msg; + + QMessageBox::critical(0, "Error", text); + return false; + } + +}; + + +int main(int argc, char** argv) +{ + // Create a QApplication instance first + QtSafeApplication qSafeApp(argc, argv); + qSafeApp.setApplicationName("mitkDiffusion"); + qSafeApp.setOrganizationName("DKFZ"); + + bool showSplashScreen(true); + + QPixmap pixmap( ":/splash/splashscreen.png" ); + QSplashScreen splash( pixmap ); + splash.setMask( pixmap.mask() ); + splash.setWindowFlags( Qt::SplashScreen | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); + + if (showSplashScreen) + { + splash.show(); + + qSafeApp.sendPostedEvents(); + qSafeApp.processEvents(); + qSafeApp.flush(); + + QTimer::singleShot(4000, &splash, SLOT(close()) ); + } + + // This function checks if an instance is already running + // and either sends a message to it (containing the command + // line arguments) or checks if a new instance was forced by + // providing the BlueBerry.newInstance command line argument. + // In the latter case, a path to a temporary directory for + // the new application's storage directory is returned. + QString storageDir = handleNewAppInstance(&qSafeApp, argc, argv, "BlueBerry.newInstance"); + + // These paths replace the .ini file and are tailored for installation + // packages created with CPack. If a .ini file is presented, it will + // overwrite the settings in MapConfiguration + Poco::Path basePath(argv[0]); + basePath.setFileName(""); + + Poco::Path provFile(basePath); + provFile.setFileName("mitkDiffusion.provisioning"); + + Poco::Util::MapConfiguration* diffConfig(new Poco::Util::MapConfiguration()); + if (!storageDir.isEmpty()) + { + diffConfig->setString(berry::Platform::ARG_STORAGE_DIR, storageDir.toStdString()); + } + + diffConfig->setString(berry::Platform::ARG_PROVISIONING, provFile.toString()); + diffConfig->setString(berry::Platform::ARG_APPLICATION, "org.mitk.qt.diffusionimagingapp"); + + // Preload the org.mitk.gui.qt.ext plug-in (and hence also QmitkExt) to speed + // up a clean-cache start. This also works around bugs in older gcc and glibc implementations, + // which have difficulties with multiple dynamic opening and closing of shared libraries with + // many global static initializers. It also helps if dependent libraries have weird static + // initialization methods and/or missing de-initialization code. + diffConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY, "liborg_mitk_gui_qt_common"); + + return berry::Starter::Run(argc, argv, diffConfig); +} diff --git a/Applications/mitkDiffusion/mitkDiffusion.ini b/Applications/mitkDiffusion/mitkDiffusion.ini new file mode 100644 index 0000000000..739d228940 --- /dev/null +++ b/Applications/mitkDiffusion/mitkDiffusion.ini @@ -0,0 +1,2 @@ +BlueBerry.home=@BLUEBERRY_BINARY_DIR@ +BlueBerry.provisioning=@DIFFUSIONIMAGINGAPP_PROVISIONING_FILE@ \ No newline at end of file diff --git a/Applications/mitkDiffusion/splashscreen.png b/Applications/mitkDiffusion/splashscreen.png new file mode 100644 index 0000000000..b4cf03a04f Binary files /dev/null and b/Applications/mitkDiffusion/splashscreen.png differ diff --git a/Applications/mitkDiffusion/splashscreen.qrc b/Applications/mitkDiffusion/splashscreen.qrc new file mode 100644 index 0000000000..2ec5e013ea --- /dev/null +++ b/Applications/mitkDiffusion/splashscreen.qrc @@ -0,0 +1,6 @@ + + + + splashscreen.png + + diff --git a/Applications/mitkDiffusion/splashscreen.xcf b/Applications/mitkDiffusion/splashscreen.xcf new file mode 100644 index 0000000000..61edc29dcd Binary files /dev/null and b/Applications/mitkDiffusion/splashscreen.xcf differ diff --git a/Applications/mitkDiffusion/startmitkDiffusion.bat.in b/Applications/mitkDiffusion/startmitkDiffusion.bat.in new file mode 100644 index 0000000000..22d1f9f605 --- /dev/null +++ b/Applications/mitkDiffusion/startmitkDiffusion.bat.in @@ -0,0 +1,2 @@ +PATH=@MITK_RUNTIME_PATH@;%PATH% +@VS_BUILD_TYPE@\mitkDiffusion.exe diff --git a/Applications/mitkDiffusion/target_libraries.cmake b/Applications/mitkDiffusion/target_libraries.cmake new file mode 100644 index 0000000000..93c17932c5 --- /dev/null +++ b/Applications/mitkDiffusion/target_libraries.cmake @@ -0,0 +1,10 @@ + +# A list of plug-in targets which should be automatically enabled +# (or be available in external projects) for this application. + +set(target_libraries + org_blueberry_compat + org_blueberry_ui_qt + org_blueberry_ui_qt_help + org_mitk_gui_qt_diffusionimagingapp +) diff --git a/CMake/CPackDiffusionConfig.cmake.in b/CMake/CPackDiffusionConfig.cmake.in new file mode 100644 index 0000000000..3e9f71937e --- /dev/null +++ b/CMake/CPackDiffusionConfig.cmake.in @@ -0,0 +1,33 @@ + +include("@MITK_BINARY_DIR@/MITKCPackOptions.cmake") + +if(CPACK_GENERATOR MATCHES "NSIS") + + # set the package header icon for MUI + SET(CPACK_PACKAGE_ICON "@MITK_SOURCE_DIR@\\mitk.bmp") + # set the install/unistall icon used for the installer itself + # There is a bug in NSIS that does not handle full unix paths properly. + SET(CPACK_NSIS_MUI_ICON "@MITK_SOURCE_DIR@\\mitk.ico") + SET(CPACK_NSIS_MUI_UNIICON "@MITK_SOURCE_DIR@\\mitk.ico") + + set(CPACK_NSIS_DISPLAY_NAME "MITK Diffusion") + + # tell cpack to create links to the doc files + SET(CPACK_NSIS_MENU_LINKS + "http://www.mitk.org" "MITK Web Site" + ) + + # tell cpack the executables you want in the start menu as links + SET(CPACK_PACKAGE_EXECUTABLES "mitkDiffusion;Start MITK Diffusion" CACHE INTERNAL "Collecting windows shortcuts to executables") + + # tell cpack to create a desktop link to MainApp + SET(CPACK_CREATE_DESKTOP_LINKS "mitkDiffusion") + SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\mitk.ico") + SET(CPACK_NSIS_HELP_LINK "http:\\\\www.mitk.org") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\www.mitk.org") + SET(CPACK_NSIS_CONTACT mitk@mitk.org) + SET(CPACK_NSIS_MODIFY_PATH ON) + +endif(CPACK_GENERATOR MATCHES "NSIS") + + diff --git a/CMake/CPackOptionsDiffusion.cmake b/CMake/CPackOptionsDiffusion.cmake new file mode 100644 index 0000000000..71e2c064c1 --- /dev/null +++ b/CMake/CPackOptionsDiffusion.cmake @@ -0,0 +1,29 @@ +# Set Diffusion specific CPack options + +set(CPACK_PACKAGE_EXECUTABLES "mitkDiffusion;MITK Diffusion") +set(CPACK_PACKAGE_NAME "MITK-Diffusion") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MITK application for processing of MR diffusion imaging data.") +# Major version is the year of release +set(CPACK_PACKAGE_VERSION_MAJOR "2011") +# Minor version is assigned depending on the number of releases that year, order is "", "a", "b"..., "z" +set(CPACK_PACKAGE_VERSION_MINOR "") +# Patch versioning is not intended to be done +set(CPACK_PACKAGE_VERSION_PATCH "") + +# this should result in names like 2011, 2011a, ... +# version has to be set explicitly to avoid such things as CMake creating the install directory "MITK Diffusion 2011.." +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}${CPACK_PACKAGE_VERSION_MINOR}") + +set(CPACK_PACKAGE_DESCRIPTION_FILE "${MITK_SOURCE_DIR}/DiffusionCopyright.txt") +set(CPACK_RESOURCE_FILE_LICENSE "${MITK_SOURCE_DIR}/DiffusionCopyright.txt") + +if(CMAKE_CL_64) + set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}-win64") +elseif(MINGW) + set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}-mingw32") +elseif(WIN32) + set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}-win32") +else() + set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}") +endif() + diff --git a/CMakeLists.txt b/CMakeLists.txt index 30bcb4a02f..4d72e624e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,804 +1,813 @@ cmake_minimum_required(VERSION 2.8.4) #----------------------------------------------------------------------------- # Set a default build type if none was specified #----------------------------------------------------------------------------- if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to 'Debug' as none was specified.") set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() #----------------------------------------------------------------------------- # 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() #----------------------------------------------------------------------------- # Warn if source or build path is too long #----------------------------------------------------------------------------- if(WIN32) set(_src_dir_length_max 50) set(_bin_dir_length_max 50) if(MITK_USE_SUPERBUILD) set(_src_dir_length_max 43) # _src_dir_length_max - strlen(ITK-src) set(_bin_dir_length_max 40) # _bin_dir_length_max - strlen(MITK-build) endif() string(LENGTH "${MITK_SOURCE_DIR}" _src_n) string(LENGTH "${MITK_BINARY_DIR}" _bin_n) # The warnings should be converted to errors if(_src_n GREATER _src_dir_length_max) message(WARNING "MITK source code directory path length is too long (${_src_n} > ${_src_dir_length_max})." "Please move the MITK source code directory to a directory with a shorter path." ) endif() if(_bin_n GREATER _bin_dir_length_max) message(WARNING "MITK build directory path length is too long (${_bin_n} > ${_bin_dir_length_max})." "Please move the MITK build directory to a directory with a shorter path." ) endif() 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) include(mitkFunctionSuppressWarnings) SUPPRESS_VC_DEPRECATED_WARNINGS() #----------------------------------------------------------------------------- # 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) option(MITK_BUILD_ALL_APPS "Build all MITK applications" 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_QT "Use Nokia's Qt library" ${MITK_USE_CTK}) option(MITK_USE_DCMTK "EXEPERIMENTAL, superbuild only: Use DCMTK in MITK" OFF) option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF) option(MITK_USE_Python "Use Python wrapping in MITK" OFF) set(MITK_USE_CableSwig ${MITK_USE_Python}) mark_as_advanced(MITK_BUILD_ALL_APPS MITK_USE_CTK MITK_USE_DCMTK ) if(MITK_USE_Boost) option(MITK_USE_SYSTEM_Boost "Use the system Boost" OFF) set(MITK_USE_Boost_LIBRARIES "" CACHE STRING "A semi-colon separated list of required Boost libraries") endif() if(MITK_USE_BLUEBERRY) option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF) mark_as_advanced(MITK_BUILD_ALL_PLUGINS) if(NOT MITK_USE_CTK) message("Forcing MITK_USE_CTK to ON because of MITK_USE_BLUEBERRY") set(MITK_USE_CTK ON CACHE BOOL "Use CTK in MITK" FORCE) endif() endif() if(MITK_USE_CTK AND NOT MITK_USE_QT) message("Forcing MITK_USE_QT to ON because of MITK_USE_CTK") set(MITK_USE_QT ON CACHE BOOL "Use Nokia's Qt library in MITK" FORCE) endif() if(MITK_USE_QT) # find the package at the very beginning, so that QT4_FOUND is available find_package(Qt4 4.6.2 REQUIRED) endif() # Customize the default pixel types for multiplex macros 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(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 Unlabeled # special "subproject" catching all unlabeled targets and tests ) # 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} MITK "${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(CheckCXXSourceCompiles) include(mitkFunctionCheckCompilerFlags) include(mitkFunctionGetGccVersion) include(MacroParseArguments) include(mitkFunctionSuppressWarnings) # includes several functions include(mitkFunctionOrganizeSources) include(mitkFunctionGetVersion) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkFunctionCompileSnippets) 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) if(ITK_USE_SYSTEM_GDCM) find_package(GDCM PATHS ${ITK_GDCM_DIR} REQUIRED) endif() #----------------------------------------------------------------------------- # 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) if(NOT MITK_FAST_TESTING) if(DEFINED MITK_CTEST_SCRIPT_MODE AND (MITK_CTEST_SCRIPT_MODE STREQUAL "continuous" OR MITK_CTEST_SCRIPT_MODE STREQUAL "experimental") ) set(MITK_FAST_TESTING 1) endif() endif() #----------------------------------------------------------------------------- # Get MITK version info #----------------------------------------------------------------------------- mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK) #----------------------------------------------------------------------------- # Installation preparation # # These should be set before any MITK install macros are used #----------------------------------------------------------------------------- # 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() + if(MITK_BUILD_org.mitk.gui.qt.diffusionimagingapp) + set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} mitkDiffusion) + 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}") include(mitkSetupC++0xVariables) set(cflags ) if(WIN32) set(cflags "${cflags} -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN") endif() if(CMAKE_COMPILER_IS_GNUCXX) set(cflags "${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) mitkFunctionCheckCompilerFlags("-Wl,--as-needed" cflags) if(MITK_USE_C++0x) mitkFunctionCheckCompilerFlags("-std=c++0x" MITK_CXX_FLAGS) endif() 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_CXX_FLAGS "-Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${MITK_CXX_FLAGS}") set(MITK_CXX_FLAGS "-Woverloaded-virtual -Wstrict-null-sentinel ${MITK_CXX_FLAGS}") endif() set(MITK_C_FLAGS "${cflags} ${MITK_C_FLAGS}") set(MITK_CXX_FLAGS "${cflags} ${MITK_CXX_FLAGS}") #----------------------------------------------------------------------------- # MITK Packages #----------------------------------------------------------------------------- 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() # Test the external project template if(MITK_USE_BLUEBERRY) include(mitkTestProjectTemplate) endif() # Test the package target include(mitkPackageTest) 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 #----------------------------------------------------------------------------- include(mitkSetupVariables) #----------------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------------- file(GLOB _MODULES_CONF_FILES ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake) if(_MODULES_CONF_FILES) file(REMOVE ${_MODULES_CONF_FILES}) endif() add_subdirectory(Utilities) if(MITK_USE_BLUEBERRY) # We need to hack a little bit because MITK applications may need # to enable certain BlueBerry plug-ins. However, these plug-ins # are validated separately from the MITK plug-ins and know nothing # about potential MITK plug-in dependencies of the applications. Hence # we cannot pass the MITK application list to the BlueBerry # ctkMacroSetupPlugins call but need to extract the BlueBerry dependencies # from the applications and set them explicitly. include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake") foreach(mitk_app ${MITK_APPS}) # extract target_dir and option_name string(REPLACE "^^" "\\;" target_info ${mitk_app}) set(target_info_list ${target_info}) list(GET target_info_list 0 target_dir) list(GET target_info_list 1 option_name) # check if the application is enabled and if target_libraries.cmake exists if(${option_name} AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake") foreach(_target_dep ${target_libraries}) if(_target_dep MATCHES org_blueberry_) string(REPLACE _ . _app_bb_dep ${_target_dep}) # explicitly set the build option for the BlueBerry plug-in set(BLUEBERRY_BUILD_${_app_bb_dep} ON CACHE BOOL "Build the ${_app_bb_dep} plug-in") endif() endforeach() endif() endforeach() 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(mitkMacroCreateCTKPlugin) 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} AND NOT subproject MATCHES "Unlabeled") add_custom_target(${subproject}) endif() endforeach() #----------------------------------------------------------------------------- # Add subdirectories #----------------------------------------------------------------------------- link_directories(${MITK_LINK_DIRECTORIES}) add_subdirectory(Core) add_subdirectory(Modules) if(MITK_USE_BLUEBERRY) find_package(BlueBerry REQUIRED) set(MITK_DEFAULT_SUBPROJECTS MITK-Plugins) # Plug-in testing (needs some work to be enabled again) if(BUILD_TESTING) include(berryTestingHelpers) 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.coreapplication") endif() include("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/PluginList.cmake") set(mitk_plugins_fullpath ) foreach(mitk_plugin ${MITK_EXT_PLUGINS}) list(APPEND mitk_plugins_fullpath Plugins/${mitk_plugin}) endforeach() if(EXISTS ${MITK_PRIVATE_MODULES}/PluginList.cmake) include(${MITK_PRIVATE_MODULES}/PluginList.cmake) foreach(mitk_plugin ${MITK_PRIVATE_PLUGINS}) list(APPEND mitk_plugins_fullpath ${MITK_PRIVATE_MODULES}/${mitk_plugin}) endforeach() endif() # Specify which plug-ins belong to this project macro(GetMyTargetLibraries all_target_libraries varname) set(re_ctkplugin_mitk "^org_mitk_[a-zA-Z0-9_]+$") set(re_ctkplugin_bb "^org_blueberry_[a-zA-Z0-9_]+$") set(_tmp_list) list(APPEND _tmp_list ${all_target_libraries}) ctkMacroListFilter(_tmp_list re_ctkplugin_mitk re_ctkplugin_bb OUTPUT_VARIABLE ${varname}) endmacro() # Get infos about application directories and build options include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake") set(mitk_apps_fullpath ) foreach(mitk_app ${MITK_APPS}) list(APPEND mitk_apps_fullpath "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${mitk_app}") endforeach() ctkMacroSetupPlugins(${mitk_plugins_fullpath} BUILD_OPTION_PREFIX MITK_BUILD_ APPS ${mitk_apps_fullpath} BUILD_ALL ${MITK_BUILD_ALL_PLUGINS} COMPACT_OPTIONS) set(MITK_PLUGIN_USE_FILE "${MITK_BINARY_DIR}/MitkPluginUseFile.cmake") if(${PROJECT_NAME}_PLUGIN_LIBRARIES) ctkFunctionGeneratePluginUseFile(${MITK_PLUGIN_USE_FILE}) else() file(REMOVE ${MITK_PLUGIN_USE_FILE}) set(MITK_PLUGIN_USE_FILE ) endif() 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%") if(DEFINED CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY) if(IS_ABSOLUTE "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}") set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}/%VS_BUILD_TYPE%") else() set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}/%VS_BUILD_TYPE%") endif() else() set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/%VS_BUILD_TYPE%") endif() 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() if(MITK_USE_Boost AND MITK_USE_Boost_LIBRARIES AND NOT MITK_USE_SYSTEM_Boost) set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${Boost_LIBRARY_DIRS}") endif() #----------------------------------------------------------------------------- # 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() +if(MITK_BUILD_org.mitk.gui.qt.diffusionimagingapp) + include(CMake/CPackOptionsDiffusion.cmake) + configure_file(${PROJECT_SOURCE_DIR}/CMake/CPackDiffusionConfig.cmake.in ${PROJECT_BINARY_DIR}/CPackDiffusionConfig.cmake @ONLY) + set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackDiffusionConfig.cmake") +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) # 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). if(MITK_PLUGIN_LIBRARIES) export(TARGETS ${MITK_PLUGIN_LIBRARIES} APPEND FILE ${MITK_EXPORTS_FILE}) endif() 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) file(GLOB _MODULES_CONF_FILES RELATIVE ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME} ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake) set(MITK_MODULE_NAMES) foreach(_module ${_MODULES_CONF_FILES}) string(REPLACE Config.cmake "" _module_name ${_module}) list(APPEND MITK_MODULE_NAMES ${_module_name}) endforeach() 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) #----------------------------------------------------------------------------- # MITK Applications #----------------------------------------------------------------------------- # This must come after MITKConfig.h was generated, since applications # might do a find_package(MITK REQUIRED). add_subdirectory(Applications) diff --git a/DiffusionCopyright.txt b/DiffusionCopyright.txt new file mode 100644 index 0000000000..91a71b2ad9 --- /dev/null +++ b/DiffusionCopyright.txt @@ -0,0 +1,15 @@ +Copyright (c) 2003-2011 German Cancer Research Center, +Division of Medical and Biological Informatics +All rights reserved. + +Redistribution and use, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +2. The name of the German Cancer Research Center, the name of mint medical, nor the names of any contributors, may be used to endorse or promote products derived from this software without specific prior written permission. + +3. Modified versions must be plainly marked as such, and must not be misrepresented as being the original software. + +THIS SOFTWARE IS NOT INTENDED FOR ANY MEDICAL USE. IT IS NOT FDA OR CE APPROVED. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file