Difference between revisions of "Documentation/Nightly/Developers/Build Instructions/Configure"
From Slicer Wiki
Line 13: | Line 13: | ||
==== Windows ==== | ==== Windows ==== | ||
*'''Recommended''': <code>cmake-gui</code> | *'''Recommended''': <code>cmake-gui</code> | ||
− | |||
** Set the build directory. For example: <code>C:\Slicer-SuperBuild-Debug</code> or <code>C:\Slicer-SuperBuild-Release</code>. | ** Set the build directory. For example: <code>C:\Slicer-SuperBuild-Debug</code> or <code>C:\Slicer-SuperBuild-Release</code>. | ||
− | * ' | + | *** Windows [http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#maxpath doesn't support file path longer than 260 characters], please make sure that the total path name of your <code>Slicer-build</code> directory is no longer than 50 characters (for example <code>c:\work\Slicer\Slicer-SuperBuild</code> (32 characters) is fine). 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 9 2008 Win64 | |
− | + | ** Configure using default options. You may get a configuration error that <code>QT_QMAKE_EXECUTABLE</code> is not set, which is normal (you usually have to set Qt path manually unless you downloaded and installed the Qt binary package that you would like to use and only have one Qt version installed on your computer). | |
− | + | ** Verify that <code>QT_QMAKE_EXECUTABLE</code>variable is set correctly and change as needed. | |
− | + | *** Automatic detection may find an installed Qt version while you may want to use your own custom built Qt(e.g. in Debug mode for use with the designer) set the. | |
− | + | *** <code>QT_QMAKE_EXECUTABLE</code> should be set to the path of the qmake.exe file, which is inside the bin directory (for example, <code>\path\to\qt-everywhere-opensource-build-4.8.6\bin\qmake.exe</code>). | |
+ | ** If building in debug mode: SimpleITK has to be disabled for building in debug mode. See more information at http://www.na-mic.org/Bug/view.php?id=3816 (you get this error if you attempt it: LINK : fatal error LNK1104: cannot open file 'python27_d.lib') | ||
+ | ** Click generate. | ||
+ | ** Close cmake-gui. | ||
+ | ** Open the top-level Slicer.sln file in the build directory in Visual Studio | ||
+ | ** Release configuration if building in release mode | ||
+ | *** 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. If you are making a release build, then you can avoid the need for a manual build configuration switching by setting your CMAKE_CONFIGURATION_TYPES to Release. | ||
# [[Documentation/{{documentation/version}}/Developers/Tutorials/Debug_Instructions|Step-by-step debug instuctions]] | # [[Documentation/{{documentation/version}}/Developers/Tutorials/Debug_Instructions|Step-by-step debug instuctions]] | ||
+ | ** Build the ALL_BUILD project | ||
==== Unix-like ==== | ==== Unix-like ==== |
Revision as of 21:41, 5 January 2015
Home < Documentation < Nightly < Developers < Build Instructions < Configure
For the latest Slicer documentation, visit the read-the-docs. |
Contents
CONFIGURE and generate Slicer solution files
You can configure and generate Slicer solution files using either ccmake
or cmake-gui
.
Per-platform instructions
Windows
- Recommended:
cmake-gui
- Set the build directory. For example:
C:\Slicer-SuperBuild-Debug
orC:\Slicer-SuperBuild-Release
.- Windows doesn't support file path longer than 260 characters, please make sure that the total path name of your
Slicer-build
directory is no longer than 50 characters (for examplec:\work\Slicer\Slicer-SuperBuild
(32 characters) is fine). 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.
- Windows doesn't support file path longer than 260 characters, please make sure that the total path name of your
- Select your compiler: Visual Studio 9 2008 Win64
- Configure using default options. You may get a configuration error that
QT_QMAKE_EXECUTABLE
is not set, which is normal (you usually have to set Qt path manually unless you downloaded and installed the Qt binary package that you would like to use and only have one Qt version installed on your computer). - Verify that
QT_QMAKE_EXECUTABLE
variable is set correctly and change as needed.- Automatic detection may find an installed Qt version while you may want to use your own custom built Qt(e.g. in Debug mode for use with the designer) set the.
QT_QMAKE_EXECUTABLE
should be set to the path of the qmake.exe file, which is inside the bin directory (for example,\path\to\qt-everywhere-opensource-build-4.8.6\bin\qmake.exe
).
- If building in debug mode: SimpleITK has to be disabled for building in debug mode. See more information at http://www.na-mic.org/Bug/view.php?id=3816 (you get this error if you attempt it: LINK : fatal error LNK1104: cannot open file 'python27_d.lib')
- Click generate.
- Close cmake-gui.
- Open the top-level Slicer.sln file in the build directory in Visual Studio
- Release configuration if building in release mode
- 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. If you are making a release build, then you can avoid the need for a manual build configuration switching by setting your CMAKE_CONFIGURATION_TYPES to Release.
- Set the build directory. For example:
- Build the ALL_BUILD project
Unix-like
- Recommended:
ccmake
- 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 -DQT_QMAKE_EXECUTABLE:FILEPATH=/path/to/QtSDK/Desktop/Qt/486/gcc/bin/qmake ../Slicer
where you replace /path/to/QtSDK with the real path on your machine where QtSDK is located
- Remarks:
- Using top-level directory name like
Slicer-SuperBuild-Release
orSlicer-SuperBuild-Debug
is recommended. - Step-by-step debug instuctions
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
- 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) inSlicer-SuperBuild
, which will update and build the external libraries and if successful will then build the subproject Slicer-build. - 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) inSlicer-SuperBuild/Slicer-build
is necessary (the external libraries are considered built and up to date). - Warning: An significant amount of disk space is required to compile Slicer in Debug (>10GB on Windows)
Workaround firewall blocking git protocol
- Some firewall will be blocking the git protocol, a possible workaround is to configure Slicer disabling the option
Slicer_USE_GIT_PROTOCOL
. Then http protocol will be used instead. Consider also reading https://github.com/commontk/CTK/issues/33
Notes for advanced users
- By default, if CMake finds Java on your machine, it automatically builds Java CLIs. If you don't want any Java in your Slicer (or if you don't want to install Java on your Mac Os X), you can pass
-DCMAKE_DISABLE_FIND_PACKAGE_Java:BOOL=TRUE
when configuring Slicer. - Same applies for OpenSSL:
CMAKE_DISABLE_FIND_PACKAGE_OpenSSL:BOOL=TRUE
can be passed when building Slicer for packaging.