Difference between revisions of "Documentation/4.0/Developers/Build Instructions"

From Slicer Wiki
Jump to: navigation, search
Line 7: Line 7:
== Prerequisites ==
== Prerequisites ==
* [http://www.cmake.org/cmake/resources/software.html CMake] version >= 2.8.2
* [http://www.cmake.org/cmake/resources/software.html CMake] version >= 2.8.2
* <font color="red">Linux prerequisites</font> (''need to confirm'')
* Linux prerequisites (''need to confirm'')
** gcc
** gcc
** gcc-c++
** gcc-c++
Line 18: Line 18:
*** [http://git-scm.com/download Download Git]
*** [http://git-scm.com/download Download Git]
*** install git: <code>sudo apt-get install git</code>. If <code>git --version</code> is inferior to 1.6.5, then:<code>sudo dpkg --install git-core_1.6.5-1~bpo50+1_amd64.deb</code>
*** install git: <code>sudo apt-get install git</code>. If <code>git --version</code> is inferior to 1.6.5, then:<code>sudo dpkg --install git-core_1.6.5-1~bpo50+1_amd64.deb</code>
* <font color="red">Windows prerequisites</font>
* Windows prerequisites
** Microsoft Visual Studio 2008 or 2010 (including [http://www.microsoft.com/express/Downloads/#2010-Visual-CPP Express Edition])
** Microsoft Visual Studio 2008 or 2010 (including [http://www.microsoft.com/express/Downloads/#2010-Visual-CPP Express Edition])
** SVN
** SVN

Revision as of 15:28, 15 June 2011

Home < Documentation < 4.0 < Developers < Build Instructions

Back to Slicer 4

The build system for Slicer4 is being developed during the second half of 2010. The goal is to provide a cross-platform build system that allows developers to quickly install and configure the multiple packages.

Where Slicer3's build system relied on a custom build script called getbuildtest, new features added to CMake, partly driven by slicer's requirements, allow porting of the scripts to rely more on native CMake functionality with the benefit that build script is more modular and general purpose.


  • CMake version >= 2.8.2
  • Linux prerequisites (need to confirm)
    • gcc
    • gcc-c++
    • libX11
    • libX11-devel (libX11-dev on Ubuntu 7.04)
    • libXt-devel (libXt-dev on Ubuntu)
    • opengl/mesa (libgl1-mesa-dev on Ubuntu) (and libosmesa6-dev on Ubuntu)
    • glu (libglu1-mesa-dev on Ubuntu)
    • git version >= 1.6.5
      • Download Git
      • install git: sudo apt-get install git. If git --version is inferior to 1.6.5, then:sudo dpkg --install git-core_1.6.5-1~bpo50+1_amd64.deb
  • Windows prerequisites
  • QT: Use one of the links provided in the table below to download the source code or binary of QT. If required, you can download the source code and compile Qt using the instructions in Slicer4: Build Instructions for QT.
Linux Mac Windows
Tiger Leopard, SnowLeopard
32bits 64bits 32bits 64bits 32bits 64bits
Qt source link 4.6.3 4.6.3 4.6.3 (vs2008)
4.7.3 (vs2010)
Qt binary link 2010.05 2010.05 4.7.0 20010-05 4.6.3 (vs2008) -

Step1: Checkout slicer source files using subversion

For example:

cd MyProjects
svn co http://svn.slicer.org/Slicer4/trunk Slicer4

Important Notes:

  1. If you are using VS2010, checkout Python-2.6.6-vc2010.tgz file from the svn. See the instructions in Slicer4: Build Instructions for Python for more details.

Step2: Configure and generate Slicer solution files

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

  • cmake-gui (Recommended): Configure using default options.

Note for Qt:

  1. If you downloaded the Qt binary then qmake will be detected and all paths will be set automatically.
  2. If you built your own Qt (e.g. in Debug mode for use with the designer) set the QT_QMAKE_EXECUTABLE in cmake-gui.QT_QMAKE_EXECUTABLE should be set to the path of the qmake.exe file, which is inside the bin directory (for example, ./QT/qt-everywhere-opensource-src-4.7.3/bin/qmake.exe).
  • ccmake (for linux/mac): Configure using the following commands. For developers, set the CMAKE_BUILD_TYPE to Debug.
mkdir Slicer4-SuperBuild
cd Slicer4-SuperBuild
ccmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/myself/qt-4.6.3/qt/bin/qmake ../Slicer4

Two projects are generated by ccmake/cmake-gui. One of them is in the top-level bin directory Slicer4-Superbuild and the other one is in the subdirectory Slicer4-Superbuild/Slicer-build:

  1. The first project in Slicer4-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 Slicer4-Superbuild, which will update and build the external libraries and if successful will then build the subproject Slicer-build.
  2. The second project in Slicer4-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 Slicer4-Superuild/Slicer-build is necessary (the external libraries are considered built and up to date).

Important Notes:

  1. For Windows users:Windows doesn't support path longer than 260 characters, please make sure that the total path name of your Slicer-build directory is no longer than 75 characters ( for example "c:\work\Slicer\Slicer-Superbuild" (32 characters) is fine)
  2. Warning: a lot of space disk is necessary to compile Slicer (>10GB on Windows)

Step3: Build Slicer4

After configuration, start the build process in the Slicer4-SuperBuild directory

  • Linux / Mac: Run the following code:
  • Windows: Open Slicer4-SuperBuild\Slicer.sln (or Slicer-4.0\Slicer4-SuperBuild\Slicer-build\Slicer.sln) in Visual Studio and build the ALL_BUILD project.

Important Notes:

  1. As it is indicated in Step2, if you make local changes in Slicer4, run make (or build the solution file in Visual Studio) in the directory Slicer4-Superuild/Slicer-build.

Step4: Run Slicer4

Run the launcher in Slicer4-SuperBuild/Slicer-build/Slicer (Slicer.exe on windows)

Platform Notes

  • Linux Ubuntu: if you have odd rendering artifacts, try disabling visual effects (System/Appearance/Visual Effects)