diff --git a/Applications/PluginGenerator/ProjectTemplate/CMakeLists.txt b/Applications/PluginGenerator/ProjectTemplate/CMakeLists.txt index a6d675ad45..c54a6b4a9e 100644 --- a/Applications/PluginGenerator/ProjectTemplate/CMakeLists.txt +++ b/Applications/PluginGenerator/ProjectTemplate/CMakeLists.txt @@ -1,378 +1,381 @@ cmake_minimum_required(VERSION 2.8.4) # Change project and application name to your own set(MY_PROJECT_NAME $(project-name)) set(MY_APP_NAME $(project-app-name)) #----------------------------------------------------------------------------- # 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(${MY_PROJECT_NAME}_USE_SUPERBUILD "Build ${MY_PROJECT_NAME} and the projects it depends on via SuperBuild.cmake." ON) if(${MY_PROJECT_NAME}_USE_SUPERBUILD) project(${MY_PROJECT_NAME}-superbuild) set(${MY_PROJECT_NAME}_SOURCE_DIR ${PROJECT_SOURCE_DIR}) set(${MY_PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR}) else() project(${MY_PROJECT_NAME}) 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 ${${MY_PROJECT_NAME}_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- include(MacroEmptyExternalProject) #----------------------------------------------------------------------------- # Output directories. #----------------------------------------------------------------------------- foreach(type LIBRARY RUNTIME ARCHIVE) set(output_dir ${${MY_PROJECT_NAME}_BINARY_DIR}/bin) 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 Options (also shown during superbuild) #----------------------------------------------------------------------------- option(BUILD_SHARED_LIBS "Build ${MY_PROJECT_NAME} with shared libraries" ON) option(WITH_COVERAGE "Enable/Disable coverage" OFF) option(BUILD_TESTING "Test the project" ON) option(${MY_PROJECT_NAME}_BUILD_ALL_PLUGINS "Build all ${MY_PROJECT_NAME} plugins" OFF) mark_as_advanced(${MY_PROJECT_NAME}_INSTALL_RPATH_RELATIVE ${MY_PROJECT_NAME}_BUILD_ALL_PLUGINS ) #----------------------------------------------------------------------------- # 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) #----------------------------------------------------------------------------- # Superbuild script #----------------------------------------------------------------------------- if(${MY_PROJECT_NAME}_USE_SUPERBUILD) include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake") return() endif() #***************************************************************************** #**************************** END OF SUPERBUILD **************************** #***************************************************************************** #----------------------------------------------------------------------------- # Prerequesites #----------------------------------------------------------------------------- find_package(MITK REQUIRED) link_directories(${MITK_LINK_DIRECTORIES}) #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) include(mitkFunctionCheckCompilerFlags) include(mitkFunctionGetGccVersion) include(mitkFunctionGetVersion) #----------------------------------------------------------------------------- # Set project specific options and variables (NOT available during superbuild) #----------------------------------------------------------------------------- set(${PROJECT_NAME}_VERSION_MAJOR "0") set(${PROJECT_NAME}_VERSION_MINOR "1") set(${PROJECT_NAME}_VERSION_PATCH "1") set(${PROJECT_NAME}_VERSION_STRING "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}") # Ask the user if a console window should be shown with the applications option(${PROJECT_NAME}_SHOW_CONSOLE_WINDOW "Use this to enable or disable the console window when starting GUI Applications" ON) mark_as_advanced(${PROJECT_NAME}_SHOW_CONSOLE_WINDOW) if(NOT UNIX AND NOT MINGW) set(MITK_WIN32_FORCE_STATIC "STATIC") endif() set(${PROJECT_NAME}_MODULES_PACKAGE_DEPENDS_DIR "${PROJECT_SOURCE_DIR}/CMake/PackageDepends") list(APPEND MODULES_PACKAGE_DEPENDS_DIRS ${${PROJECT_NAME}_MODULES_PACKAGE_DEPENDS_DIR}) #----------------------------------------------------------------------------- # Get project version info #----------------------------------------------------------------------------- mitkFunctionGetVersion(${PROJECT_SOURCE_DIR} ${PROJECT_NAME}) #----------------------------------------------------------------------------- # Installation preparation # # These should be set before any MITK install macros are used #----------------------------------------------------------------------------- # on Mac OSX all CTK plugins get copied into every # application bundle (.app directory) specified here set(MACOSX_BUNDLE_NAMES) if(APPLE) list(APPEND MACOSX_BUNDLE_NAMES ${MY_APP_NAME}) 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) # The MITK module build system does not yet support default hidden visibility set(VISIBILITY_CXX_FLAGS ) # "-fvisibility=hidden -fvisibility-inlines-hidden") endif() #----------------------------------------------------------------------------- # Set coverage Flags #----------------------------------------------------------------------------- if(WITH_COVERAGE) if(CMAKE_COMPILER_IS_GNUCXX) set(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG") set(COVERAGE_CXX_FLAGS ${coverage_flags}) set(COVERAGE_C_FLAGS ${coverage_flags}) endif() endif() #----------------------------------------------------------------------------- # Project C/CXX Flags #----------------------------------------------------------------------------- set(${PROJECT_NAME}_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}") set(${PROJECT_NAME}_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) + # Enable link dependency optimization to only link libraries which satisfy undefined + # symbol references. This aligns the link behavior with the one from the Windows linker. + mitkFunctionCheckCompilerFlags("-Wl,--as-needed" 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(${PROJECT_NAME}_CXX_FLAGS "-Wl,--enable-auto-import ${${PROJECT_NAME}_CXX_FLAGS}") # we need to define a Windows version set(${PROJECT_NAME}_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${${PROJECT_NAME}_CXX_FLAGS}") endif() set(${PROJECT_NAME}_C_FLAGS "${cflags} ${${PROJECT_NAME}_C_FLAGS}") set(${PROJECT_NAME}_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wstrict-null-sentinel -Wsign-promo ${${PROJECT_NAME}_CXX_FLAGS}") # The following line produces a lot of warnings in MITK header files... #set(${PROJECT_NAME}_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${${PROJECT_NAME}_CXX_FLAGS}") endif() #----------------------------------------------------------------------------- # Set C/CXX Flags #----------------------------------------------------------------------------- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${PROJECT_NAME}_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${PROJECT_NAME}_C_FLAGS}") #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if(BUILD_TESTING) enable_testing() include(CTest) mark_as_advanced(TCL_TCLSH DART_ROOT) # Setup file for setting custom ctest vars configure_file( CMake/CTestCustom.cmake.in ${CMAKE_CURRENT_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; } ") endif() #----------------------------------------------------------------------------- # ${MY_PROJECT_NAME}_SUPERBUILD_BINARY_DIR #----------------------------------------------------------------------------- # If ${MY_PROJECT_NAME}_SUPERBUILD_BINARY_DIR isn't defined, it means this project is # *NOT* build using Superbuild. In that specific case, ${MY_PROJECT_NAME}_SUPERBUILD_BINARY_DIR # should default to PROJECT_BINARY_DIR if(NOT DEFINED ${PROJECT_NAME}_SUPERBUILD_BINARY_DIR) set(${PROJECT_NAME}_SUPERBUILD_BINARY_DIR ${PROJECT_BINARY_DIR}) endif() #----------------------------------------------------------------------------- # Qt support #----------------------------------------------------------------------------- if(MITK_USE_QT) set(QT_QMAKE_EXECUTABLE ${MITK_QMAKE_EXECUTABLE}) add_definitions(-DQWT_DLL) endif() #----------------------------------------------------------------------------- # MITK modules #----------------------------------------------------------------------------- # This project's directory holding module config files #set(${PROJECT_NAME}_MODULES_CONF_DIR "${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}") # Append this projects's module config directory to the global list # (This is used to get include directories for the Exports.h files right) #list(APPEND MODULES_CONF_DIRS ${${PROJECT_NAME}_MODULES_CONF_DIR}) # Clean the modulesConf directory. This ensures that modules are sorted # according to their dependencies in the Modules/CMakeLists.txt file #file(GLOB _modules_conf_files ${${PROJECT_NAME}_MODULES_CONF_DIR}/*.cmake) #if(_modules_conf_files) # file(REMOVE ${_modules_conf_files}) #endif() #add_subdirectory(Modules) #----------------------------------------------------------------------------- # CTK plugins #----------------------------------------------------------------------------- # The CMake code in this section *must* be in the top-level CMakeLists.txt file macro(GetMyTargetLibraries all_target_libraries varname) set(re_ctkplugin "^$(project-plugin-base)_[a-zA-Z0-9_]+$") set(_tmp_list) list(APPEND _tmp_list ${all_target_libraries}) ctkMacroListFilter(_tmp_list re_ctkplugin OUTPUT_VARIABLE ${varname}) endmacro() include(${CMAKE_CURRENT_SOURCE_DIR}/Plugins/Plugins.cmake) ctkMacroSetupPlugins(${PROJECT_PLUGINS} BUILD_OPTION_PREFIX ${MY_PROJECT_NAME}_ BUILD_ALL ${${MY_PROJECT_NAME}_BUILD_ALL_PLUGINS}) #----------------------------------------------------------------------------- # Add subdirectories #----------------------------------------------------------------------------- add_subdirectory(Apps/$(project-app-name)) #----------------------------------------------------------------------------- # Installation #----------------------------------------------------------------------------- # set MITK cpack variables include(mitkSetupCPack) # Customize CPack variables for this project include(CPackSetup) list(APPEND CPACK_CREATE_DESKTOP_LINKS "${MY_APP_NAME}") configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}CPackOptions.cmake @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}CPackOptions.cmake") # include CPack model once all variables are set include(CPack) # Additional installation rules include(mitkInstallRules) #----------------------------------------------------------------------------- # Last configuration steps #----------------------------------------------------------------------------- # 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("${PROJECT_SOURCE_DIR}/CMake/StartVS.bat.in" ${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat ${VS_BUILD_TYPE}) endforeach() endif(WIN32) diff --git a/Documentation/Doxygen/BuildInstructions.dox b/Documentation/Doxygen/BuildInstructions.dox index 48c4f54aef..1677bdd184 100644 --- a/Documentation/Doxygen/BuildInstructions.dox +++ b/Documentation/Doxygen/BuildInstructions.dox @@ -1,163 +1,201 @@ /** \page BuildInstructionsPage Build Instructions \section BIZero Introduction The MITK build system (which is based on CMake) supports a "superbuild" process, meaning that it will download, configure, and build all required third-party libraries (except Qt) automatically. These instructions will show you how to use the MITK superbuild. \note This page explains explicitly how to build MITK itself. If you want to create your own project based on MITK, the process -described below is completely automated. Please see http://www.mitk.org/wiki/SetupAMitkBasedProject +described below is completely automated. Please see Setup a MITK-based project For more advanced users, the last sections explain how to inject custom build libraries into the supebuild process. \section BIOne Prerequisites You need: - -# Git from http://git-scm.com (there are also numerous third-party graphical clients available) + -# Git from http://git-scm.com (there are also numerous third-party graphical clients available). We recomment using + Git, but see below for a way how to get the current source code without using it. -# CMake (version 2.8.4 or higher) -# Qt 4.x if you plan to develop Qt-based applications - (version 4.5 or above is recommended, we cannot guarantee compatibility with lower versions) + (version 4.6 or above is recommended, we cannot guarantee compatibility with lower versions) + +\section BIQt A note about Qt + +Nokia provides several binary packages for Qt. You must make sure that the package you download matches +your toolchain. On Linux, getting Qt by installing the packages provided by your Linux package manager is the preferred way. + +On Windows, the Nokia provided binaries are compiled for 32bit architectures. You cannot build your own project for a 64bit machine and +use the 32bit Qt libraries. You have two options for a 64bit Qt-based application: + -# Download an inofficial 64bit installer, for example here. Note + that we cannot offer support for problems with MITK due to the usage of this kind of installers. + -# Compile Qt yourself. This is shortly described below. + +To compile Qt on Windows using Visual Studio, follow the steps below: + + -# Download the Qt sources and unpack them, e.g. to C:/qt-everywhere-opensource-src-4.7.4 + -# Open a Visual Studio command prompt. Make sure to use the appropriate command prompt for either a 32 bit or 64 bit build. + Note that Visual Studio Express does not come with 64bit compilers out of the box (the Professional version does). + -# Configure Qt by executing the configure.exe command in your Qt source directory. The following configure options will + build a Qt compatible with MITK: + \verbatim +configure.exe -prefix C:\Qt\4.7.4_vc9_x64 -debug-and-release -qt-sql-sqlite -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -mp -nomake examples -nomake demos -nomake docs +\endverbatim + -# Build and install the Qt libraries + \verbatim +nmake +nmake install +\endverbatim + After "nmake install" completed successfully, you may delete your Qt source directory. \section BITwo Get a source tree Since MITK is under active development we recommend to use git to get the most recent version. To make sure you get a stable tree, check the MITK dashboard before checking out. If the build tree is not clean, you can specify an older revision for the checkout or get a stable tar ball from -www.mitk.org +www.mitk.org. + +If you don't want to use Git, you may also download the current source code (or any other older version) +as a tar.gz package by clicking on the +snapshot link. You can then +skip the clone step below. To clone MITK's current git repository do: \code git clone http://git.mitk.org/MITK.git \endcode \section BIThree Build MITK with CMake Create a new directory for the superbuild binary tree, change to it and call CMake: In the shell (assuming you current directory is the same as the one where you issued the git clone command): \code mkdir MITK-superbuild cd MITK-superbuild ccmake ../MITK \endcode If you use Windows, then you just start the CMake GUI and enter the location of the source and of the binary tree, choose a suitable generator and configure the project. CMake will present you a couple of options, these are the most important ones: + - MITK_USE_BLUEBERRY Build the BlueBerry application framework - MITK_USE_Boost Build MITK code which depends on Boost (this will download Boost 1.45.0) - - MITK_USE_OpenCV Build MITK code which depends on OpenCV (this will download and build OpenCV 2.2) + - MITK_USE_Boost_LIBRARIES If you need binary Boost libraries, specify them here. + - MITK_USE_OpenCV Build MITK code which depends on OpenCV (this will download and build OpenCV 2.3) + - MITK_USE_Python Enables Python wrapping in MITK. This will also configure ITK, VTK, and OpenCV (if enabled) to build Python wrappers. - MITK_USE_QT Build MITK code which depends on Qt - QT_QMAKE_EXECUTABLE The path to the qmake executable of your Qt installation If you are satisfied with the configuration of your MITK superbuild, generate the project files with CMake by pressing "Generate". Linux users usually just enter "make" (optionally supplying the number threads to be used for a parallel build): \code make -j4 \endcode Windows users using Visual Studio can open the generated MITK-superbuild.sln solution file in the MITK-superbuild directory and start the build by building the BUILD_ALL project. \section BIFour Customize your MITK superbuild The MITK superbuild configured MITK with all needed external libraries. The build directories of these libraries, and of MITK itself are located inside the MITK-superbuild directory. For example, the directory layout may look like: \code MITK-superbuild |- ITK-build |- VTK-build |- MITK-build \endcode To change the configuration of the MITK build, choose the MITK-build directory as the binary directory in the CMake GUI. After generating the project files, build the MITK project by either issuing "make" in the MITK-build directory (Linux), or by opening MITK-build/MITK.sln and building the project with Visual Studio. You may also change the configuration of any project configured via the superbuild process. Make sure to also build the changed project and also the projects which depend on it. \section BIFive Running Applications On Linux, just execute the application you want to run. MITK executables are located in MITK-superbuild/MITK-build/bin On Windows, the PATH environment variable must contain the directories containging third-party libraries. The MITK build system generated Windows Batch files in the MITK-build directory which set up a correct environment and opens the appropriate Visual Studio solution file. Use (and maybe modify/enhance) these Batch files to be able to start and debug MITK applications from inside Visual Studio. \section BISix Documentation If you have the Doxygen documentation tool installed, you get a new project (Visual Studio) or "make" target named "doc". You can build this to generate the HTML documentation of MITK in the Documentation/Doxygen directory of your MITK-build binary tree or in the MITK_DOXYGEN_OUTPUT_DIR CMake variable (if specified). \section BISeven Extend MITK on your own (using the application framework BlueBerry) \ref NewPluginPage \section BIEight Use MITK in your own project (as a toolkit) In the MITK-build binary tree the MITKConfig.cmake file is generated. You can include it in your own project with FIND_PACKAGE(MITK) On Windows you also need FIND_PACKAGE(ITK) FIND_PACKAGE(VTK) to get the library dependencies right. After that you can set your include path with INCLUDE_DIRECTORIES(${QMITK_INCLUDE_DIRS}) and create an application: LINK_DIRECTORIES(${MITK_LINK_DIRECTORIES}) ADD_EXECUTABLE(MyApp MyApp.cpp) TARGET_LINK_LIBRARIES(Step1 ${QMITK_LIBRARIES}) \note IMPORTANT: do not include the ITK_USE_FILE in your project when using MITK. There's a conflict in the ITK and MITK tree classes which will be resolved soon. \section BINine Superbuild Customization You can inject pre-build third-party libraries into the MITK superbuild by setting certain CMake variables before the first configure step. MITK will then use these third-party libraries instead of downloading and building them itself. Note you must take care to configure those libraries with all options MITK requires. -The following variables are supported: - - - BOOST_ROOT Set this variable to your custom Boost installation - - CTK_DIR Set this variable to your CTK binary tree (the directory containing the CTKConfig.cmake file) - - DCMTK_DIR Set this variable to your DCMTK binary tree (the directory containing the DCMTKConfig.cmake file) - - GDCM_DIR Set this variable to your GDCM binary tree (the directory containing the GDCMConfig.cmake file) - - ITK_DIR Set this variable to your ITK binary tree (the directory containing the ITKConfig.cmake file) - - OpenCV_DIR Set this variable to your OpenCV binary tree (the directory containing the OpenCVConfig.cmake file) - - VTK_DIR Set this variable to your VTK binary tree (the directory containing the VTKConfig.cmake file) +The variables listed below are provided for injecting third-party libraries. Their occurrence in the CMake GUI or +in ccmake may depend on specific MITK_USE_* options set to ON. You may also use the variable names below without the +EXTERNAL_ prefix, for example when providing their values on a command line call to CMake. + + - EXTERNAL_BOOST_ROOT Set this variable to your custom Boost installation + - EXTERNAL_CTK_DIR Set this variable to your CTK binary tree (the directory containing the CTKConfig.cmake file) + - EXTERNAL_CableSwig_DIR Set this variable to your CableSwig binary tree for Python wrapping (the directory containing the CableSwigConfig.cmake file) + - EXTERNAL_DCMTK_DIR Set this variable to your DCMTK binary tree (the directory containing the DCMTKConfig.cmake file) + - EXTERNAL_GDCM_DIR Set this variable to your GDCM binary tree (the directory containing the GDCMConfig.cmake file) + - EXTERNAL_ITK_DIR Set this variable to your ITK binary tree (the directory containing the ITKConfig.cmake file) + - EXTERNAL_OpenCV_DIR Set this variable to your OpenCV binary tree (the directory containing the OpenCVConfig.cmake file) + - EXTERNAL_VTK_DIR Set this variable to your VTK binary tree (the directory containing the VTKConfig.cmake file) -To set CMake options before the first configure step is invoked, either supply them on the command line, i.e. +To set CMake options before the first configure step is invoked, supply them on the command line, i.e. \code ccmake -DITK_DIR:PATH=/opt/ITK-release ../MITK \endcode -or add them in the CMake GUI by pressing "Add Entry" (before pressing "Configure" the first time). - See the following link for more information about how to configure third-party libraries: \subpage BuildToolkits "How to build ITK, VTK and QT" */ diff --git a/Documentation/Doxygen/NewPlugin.dox b/Documentation/Doxygen/NewPlugin.dox index e0427d610d..ecf45d04be 100755 --- a/Documentation/Doxygen/NewPlugin.dox +++ b/Documentation/Doxygen/NewPlugin.dox @@ -1,95 +1,97 @@ /** \page NewPluginPage How to create a new MITK Plug-in The MITK Plugin Generator is a command line tool to simplify the process of creating your own MITK project (optional) and plug-ins. It can either be downloaded here or used from an existing MITK build. The Plugin Generator takes the following command line arguments: \verbatim ./MITKPluginGenerator -h -A CTK plug-in generator for MITK +A CTK plug-in generator for MITK (version 1.2.0) - -h, --help Show this help text - -o, --out-dir Output directory (default: /tmp) - -l, --license Path to a file containing license information (default: :/MITKLicense.txt) - -v, --vendor The vendor of the generated code (default: DKFZ, Medical and Biological Informatics) - -q, --quiet Do not print additional information - -y, --confirm-all Answer all questions with 'yes' + -h, --help Show this help text + -o, --out-dir Output directory (default: /tmp) + -l, --license Path to a file containing license information (default: :/MITKLicense.txt) + -v, --vendor The vendor of the generated code (default: DKFZ, Medical and Biological Informatics) + -q, --quiet Do not print additional information + -y, --confirm-all Answer all questions with 'yes' + -u, --check-update Check for updates and exit + -n, --no-networking Disable all network requests Plug-in View options - -vc, --view-class The View's' class name - -vn, --view-name The View's human readable name + -vc, --view-class The View's' class name + -vn, --view-name * The View's human readable name Plug-in options - -ps, --plugin-symbolic-name The plugin's symbolic name - -pn, --plugin-name The plug-in's human readable name + -ps, --plugin-symbolic-name * The plugin's symbolic name + -pn, --plugin-name The plug-in's human readable name Project options - --project-copyright Path to a file containing copyright information (default: :/MITKCopyright.txt) - --project-name The project name - --project-app-name The application name + --project-copyright Path to a file containing copyright information (default: :/MITKCopyright.txt) + --project-name The project name + --project-app-name The application name + +[* - options are required] \endverbatim If a project name is provided via the --project-name argument, the new plug-in will be generated as part of a new project. \section NewPluginOnly Creating a new MITK plug-in Here is an example call to the Plugin Generator, creating one plug-in with the symbolic name com.mycompany.myplugin and a View named My View: \verbatim ./MITKPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name "My View" \endverbatim If you did not already specify the final location of the plug-in via the --out-dir argument, move the directory (in our example /tmp/org.mycompany.myplugin) to your existing project. Do not forget to add the plug-in in your project's build system (usually in the file <your-project>/Plugins/Plugins.cmake). \section NewPluginWithProject Creating a new MITK project \subsection NewPluginProjectPrerequisites Prerequisites -You need: - -# Git from http://git-scm.com (there are also numerous third-party graphical clients available) - -# CMake (version 2.8.4 or higher) - -# Qt 4.x if you plan to develop Qt-based applications - (version 4.5 or above is recommended, we cannot guarantee compatibility with lower versions) +MITK-based projects creating with the Plugin Generator need the same prerequisites as MITK itself. See the +\ref BuildInstructionsPage for MITK for details. Here is an example call to the Plugin Generator, creating the same plug-in as above but integrated in a new project: \verbatim ./MITKPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name "My View" --project-name "MyProject" --project-app-name "MyApp" \endverbatim The generated project is completely self-contained and can be configured via CMake immediately. When building the generated project, it will first download all required dependencies (like MITK itself). For an explanation of the -project's build directory layout, see SetupAMITKBasedProject. +project's build directory layout and how to configure MITK from your project's superbuild CMake configuration, +see SetupAMITKBasedProject. -\section NewPluginLimitations +\subsection NewPluginLimitations Limitations The Plugin Generator supports only a very limited set of possible configuration options. For more customizations of your project or plug-in, you must familiarize yourself with CMake and the generated build system. Further, the generator is not able to modify existing projects, it can only create new ones. \section NewPluginBuildSystem Build system for plug-ins Just put new files in your plug-in's \c src or \c src/internal directory and edit the \c files.cmake file there. If you have any fancy stuff like external libraries and include directories you should have a look at the CMake manual and general MITK build system documentation. \section NewPluginTroubleshooting Troubleshooting \par I get "Could not find library" messages and similar stuff when I try to start my project's executable. This is mostly due to wrong environment settings. On Windows, make sure that you use the supplied batch files to start Visual Studio or your project's executable. If you still get errors, double check the value of the PATH variable in your batch files (it must contain MITK's binary directory and paths to the ITK, VTK and Qt libraries. \par On Linux, set your LD_LIBRARY_PATH variable accordingly. */