Documentation/Nightly/Developers/Build Instructions/Configure

From Slicer Wiki
Revision as of 12:09, 30 September 2018 by Lasso (talk | contribs) (→‎Windows)
Jump to: navigation, search
Home < Documentation < Nightly < Developers < Build Instructions < Configure


For the latest Slicer documentation, visit the read-the-docs.


CONFIGURE and generate Slicer solution files

There are many ways of customizing Slicer's user interface or feature set. This section describes how a custom Slicer build can be configured at build-time. See an overview of various other options in this presentation.

You can configure and generate Slicer solution files using either ccmake or cmake-gui.

Customizing application build

Customized editions of Slicer can be generated without changing Slicer source code, just by modifying CMake variables:

  • SlicerApp_APPLICATION_NAME: Custom application name to be used, instead of default "Slicer". The name is used in installation package name, window title bar, etc.
  • Slicer_DISCLAIMER_AT_STARTUP: String that is displayed to the user after first startup of Slicer after installation (disclaimer, welcome message, etc).
  • Slicer_DEFAULT_HOME_MODULE: Module name that is activated automatically on application start.
  • Slicer_DEFAULT_FAVORITE_MODULES: Modules that will be added to the toolbar by default for easy access. List contains module names, separated by space character.
  • Slicer_CLIMODULES_DISABLED: Built-in CLI modules that will be removed from the application. List contains module names, separated by semicolon character.
  • Slicer_QTLOADABLEMODULES_DISABLED: Built-in Qt loadable modules that will be removed from the application. List contains module names, separated by semicolon character.
  • Slicer_QTSCRIPTEDMODULES_DISABLED: Built-in scripted loadable modules that will be removed from the application. List contains module names, separated by semicolon character.
  • Slicer_USE_PYTHONQT_WITH_OPENSSL: enable/disable building the application with SSL support (ON/OFF)
  • Slicer_USE_SimpleITK: enable/disable SimpleITK support (ON/OFF)
  • Slicer_BUILD_SimpleFilters: enable/disable building SimpleFilters. Requires SimpleITK. (ON/OFF)
  • Slicer_BUILD_EMSegment: enable/disable building EM segmenter (ON/OFF)
  • Slicer_USE_PYTHONQT_WITH_TCL: TCL support (ON/OFF)
  • Slicer_EXTENSION_SOURCE_DIRS: Defines additional extensions that will be included in the application package as built-in modules. Full paths of extension source directories has to be specified, separated by semicolons.

Per-platform instructions

Windows

  • Recommended: run CMake (cmake-gui) from the Windows Start menu
    • Set the build directory. For example: C:\Slicer-SuperBuild-Debug or C:\Slicer-SuperBuild-Release.
      • Because Windows doesn't support file path longer than 260 characters and has a maximum command line length, please make sure that the total path name of your Slicer-build directory is no longer than 50 characters (for example c:\work\Slicer\Slicer-SuperBuild may work). In case of any build error, use very short directory names: C:\S4 for source directory, C:\S4D for debug build, C:\S4R for release build.
      • You cannot use the same build tree for both release or debug mode builds. If both build types are needed, then the same source directory can be used, but a separate build directory should be created and configured for each build type.
    • Select your compiler: Visual Studio 14 2015 Win64
    • Do not configure yet.
    • Add Qt5_DIR variable pointing to Qt5 folder such as C:\Qt\5.10.0\msvc2017_64\lib\cmake\Qt5.
    • Configure
    • Click generate then close cmake-gui.
    • If building in release mode:
      • Open the top-level Slicer.sln file in the build directory in Visual Studio
      • Set active configuration to Release. Visual Studio will select Debug build configuration by default when you first open the solution in the Visual Studio GUI. If you build Slicer in release mode and accidentally forget to switch the build configuration to Release then the build will fail. Note: you can avoid this manual configuration mode selection by setting CMAKE_CONFIGURATION_TYPES to Release in cmake-gui.
    • If building in debug mode:
    • Build the ALL_BUILD project

Unix-like

  • Recommended:
    • Configure using the following commands. By default CMAKE_BUILD_TYPE is set to Debug.
mkdir Slicer-SuperBuild-Debug
cd Slicer-SuperBuild-Debug
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR:PATH=/path/to/Qt5.11.0/5.11.0/gcc_64/lib/cmake/Qt5 ../Slicer

where you replace /path/to/QtSDK with the real path on your machine where QtSDK is located

If using Qt from the system, do not forget to add the following CMake variable to your configuration command line:

-DSlicer_USE_SYSTEM_QT:BOOL=1
  • Remarks:
  1. Instead of cmake, you can use ccmake or cmake-gui to visually inspect and edit configure options.
  2. Using top-level directory name like Slicer-SuperBuild-Release or Slicer-SuperBuild-Debug is recommended.
  3. Step-by-step debug instuctions
  • On Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite) / 10.11 (El Capitan), also set the following variables (see discussion):
Variable Description
Slicer_USE_PYTHONQT_WITH_TCL OFF
CMAKE_OSX_DEPLOYMENT_TARGET 10.9 or 10.10 or 10.11

General information

Two projects are generated by either cmake, ccmake or cmake-gui.

One of them is in the top-level bin directory Slicer-SuperBuild and the other one is in the subdirectory Slicer-build:

Slicer-SuperBuild/Slicer-build
  1. The first project in Slicer-SuperBuild manages all the external dependencies of Slicer (VTK, ITK, Python, ...). To build Slicer for the first time, run make (or build the solution file in Visual Studio) in Slicer-SuperBuild, which will update and build the external libraries and if successful will then build the subproject Slicer-build.
  2. The second project in Slicer-SuperBuild/Slicer-build is the "traditional" build directory of Slicer. After local changes in Slicer (or after an svn update on the source directory of Slicer), only running make (or building the solution file in Visual Studio) in Slicer-SuperBuild/Slicer-build is necessary (the external libraries are considered built and up to date).
  3. Warning: An significant amount of disk space is required to compile Slicer in Debug (>10GB on Windows)

Workaround for if the firewall is blocking git protocol

  • Some firewalls will block the git protocol. A possible workaround is to configure Slicer by disabling the option Slicer_USE_GIT_PROTOCOL. Then the http protocol will be used instead. Consider also reading https://github.com/commontk/CTK/issues/33