TubeTK/Build Instructions

From KitwarePublic
Jump to navigationJump to search

Overview

TubeTK has been tested on Windows, OS X, and Linux.

  • Process
    • Install system-level pre-requisites
    • Download source
    • Configure using CMake (http://cmake.org)
    • Build

System-level pre-requisites

Windows

OS X

  • CMake, version 2.8.8 or greater (cmake.org)
  • Git
  • Subversion
  • Qt, version 4.7.4 (use Homebrew or build from source; you must use version 4.7.4 to be compatible with 3D Slicer)

Note: When compiling Qt 4.7.4 from source, run configure with

 ./configure --prefix=<YourDir> --debug-and-release

The --debug-and-release option is to avoid problems when compiling TubeTK in debug mode. The default configure option for Qt is release only. Homebrew takes care of that by default.

Linux

TubeTK makes heavy use of ITK, VTK, Git, Qt (optional), and Subversion. Each of these packages depends on a variety of system-level packages, many of which are not installed by default on Linux systems. These dependencies are similar to the dependencies needed to install ParaView. So, the following will install all of the dependencies needed to build VTK and ITK (as needed by ParaView and TubeTK).

  • CMake, version 2.8.8 or greater (cmake.org)
  • Git
  • Subversion
  • Qt, version 4.7.4 (qt-project.org/downloads; compile from source, if necessary; you must use version 4.7.4 to be compatible with 3D Slicer)
  • X11
 sudo apt-get -y build-dep paraview
 sudo apt-get -y install git gitk
 sudo apt-get -y install subversion
 sudo apt-get -y install qt-sdk

Download, Configure, and Build

You have two options:

1. Have CTest do all of the remaining work

This is the recommended approach for people who will be using and developing in TubeTK. It not only builds and tests TubeTK with minimal effort, but it also submits your build as an "experimental" on the TubeTK dashboard - this allows us to more easily help you debug errors during the build process:

ctest -S <name_of_your_script_file.cmake>
This will download the source code, configure it, build it, test it, and then submit the results to the TubeTK Dashboard

2. Download, configure, and build manually

2a. Download and manage your Git repository

Please follow the detailed instructions at TubeTK/Development/Git

2b. Configure

Windows

Linux and OS X

cd ~/src/TubeTK-Release
ccmake ../TubeTK
press 'c' to configure
Set CMAKE_BUILD_TYPE to Release
Confirm CMAKE_GENERATOR is "Unix Makefiles"
press 'c' to configure again
press 'g' to generate

2c. Build

Windows

Microsoft Visual Studio

  • Load the TubeTK solution file
    • Select File -> Open -> Project/Solution -> open TubeTK-Release/TubeTK.sln
  • Perform the initial build using your compiler at the top-level of TubeTK-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
    • Right click on the "ALL_BUILD" project and select "Build".
  • Subsequent builds should be initiated in the subdir TubeTK-Release/TubeTK-Build to save time. This will build TubeTK only. You may have to periodically build from the top-level of TubeTK-Release to get updates to the libraries that TubeTK depends on.
    • Right click on the "TubeTK" project and select "Build".

Linux and OS X

  • Perform the initial build using your compiler at the top-level of tubetk-Release. This will update and build the libraries that TubeTK depends on (ex. VTK, ITK), and then build TubeTK.
mkdir ~/src/TubeTK-Release
cd ~/src/TubeTK-Release
make -j4
  • Subsequent builds should be initiated in the subdir tubetk-Release/TubeTK-Build to save time. This will build TubeTK only. You may have to periodically build from the top-level of tubetk-Release to get updates to the libraries that TubeTK depends on.
cd ~/src/TubeTK-Release/TubeTK-Build
make -j4

Advanced

Using KWStyle

For introductory information, see: http://public.kitware.com/KWStyle/

 cvs -d :pserver:anoncvs@public.kitware.com:/cvsroot/KWStyle co KWStyle
 mkdir KWStyle-Release
 cd KWStyle-Release
 ccmake ../KWStyle
 # Set BUILD_TYPE to Release
 # Configure
 # Generate
 make
 sudo make install
 cd tubetk-Release
 ccmake .
 # Turn on advanced options
 # Turn on TubeTK_USE_KWSTYLE
 # Configure
 # Set KWSTYLE_EXECUTABLE to /usr/local/bin/KWStyle
 # Configure
 # Generate
 make
 make StyleCheck

Using a pre-existing ITK or VTK installation

You can configure CMake variables to use an existing ITK or VTK installation instead of its embedded versions. This is NOT recommended, because of inter-dependencies that require specific version of these libraries, and built using specific options, to be used.

  • USE_SYSTEM_ITK: OFF
    • If "ON", then you can tell TubeTK to use an ITK build that is already present on your system (using the CMake variable ITK_DIR). See the warning below.
  • USE_SYSTEM_VTK: OFF
    • If "ON", then you can tell TubeTK to use a VTK build that is already present on your system (using the CMake variable VTK_DIR). See the warning below.
  • Dependencies on ITK and VTK versions and build options

Inside TubeTK

  • As noted above, TubeTK uses CMake's Superbuild include other libraries, as needed for the options selected.
  • Libraries that may be automatically downloaded and included by TubeTK include:
    • ITK
    • VTK
    • CTK
    • Select tools from the NA-MIC Kit:
      • TCLAP, GenerateCLP, ModuleDescriptionParser, RegisterImages
  • Libraries that must be externally installed if you want to use them with TubeTK
    • CMake (2.8.2 or greater - REQUIRED)
    • Qt (4.6.2 or greater - OPTIONAL)
  • You can manually install the above toolkits and then configure TubeTK to use those installations instead of building its own copies of those toolkits, BUT we don't recommend heading down that road.
    • Requires CMake expertise
    • Requires making sure each of the toolkits is correctly configured (via their own cmake configuration processes) for use with TubeTK.
    • If you still want to try this complex, manual, unsupported approach, then the following steps will help somewhat:
      1. Read tubetk/SuperBuild.cmake to find out the current set of cmake options required for each library.
      2. For example, at one point in tubetk history, you were required to build ITK v3.20.0, as mirrored and customized on the Slicer github account, using the following cmake vars
        • BUILD_SHARED_LIBS = OFF (or ON, but libs are VERY small in ITK because of templates)
        • ITK_USE_LIBXML2 = ON
        • ITK_USE_REVIEW = ON
        • ITK_USE_OPTIMIZED_REGISTRATION_METHODS = ON
        • ITK_USE_TRANSFORM_IO_FACTORIES = ON
        • CMAKE_CXX_FLAGS = -fPIC
        • CMAKE_C_FLAGS = -fPIC
          • adding -fPIC to both c and cxx flags can be ignored if you build with shared libs ON.
      3. You must also build non-cmake libraries, such as Qt 4.6.2 or greater
        • Tips for installing Open Source Qt to run with Visual Studio
          1. Open a visual studio command shell.
          2. Go to the Qt source directory and run "configure -platform win32-msvc2005". This will tell Qt to prepare itself for being compiled by the Visual Studio compiler. If you use another version of VS than 2005, replace win32-msvc-2005 with the appropriate one.
          3. Type "nmake" and take a break when it compiles.
          4. Add QMAKESPEC=win32-msvc2005 as a system environment variable and add QTDIR=your_dir into the system path. It is done.
        • Tips for installing Qt on Linux
          1. apt-get qt4
      4. After Qt, you must also build the Slicer customized version of VTK v5.6, from the Slicer github account, using the appropriate cmake vars, such as
        • BUILD_SHARED_LIBS = ON
        • VTK_USE_GUISupport = ON
        • VTK_USE_QVTK
      5. Again, many details are missing in the above list. We really recommend using Superbuild instead.

References

  • Superbuild and EXTERNAL_PROJECTS
    • Dave Cole's article in the October Kitware Source [1]