Difference between revisions of "ITK/Configuring and Building"

From KitwarePublic
< ITK
Jump to navigationJump to search
(Add section on wrapping)
(Fixed up blank lines in code)
Line 26: Line 26:
  # This is the Kickstart CMakeCache file for the Debian build of ITK.
  # This is the Kickstart CMakeCache file for the Debian build of ITK.
  # Only those settings that are changed from the default are specified.
  # Only those settings that are changed from the default are specified.
    
   &nbsp;
  // For some reason it defaults to c++
  // For some reason it defaults to c++
  CMAKE_CXX_COMPILER:STRING=g++
  CMAKE_CXX_COMPILER:STRING=g++
    
   &nbsp;
  // Don't build examples now (let the user later)
  // Don't build examples now (let the user later)
  BUILD_EXAMPLES:BOOL=OFF
  BUILD_EXAMPLES:BOOL=OFF
    
   &nbsp;
  // Build ITK with shared libraries
  // Build ITK with shared libraries
  BUILD_SHARED_LIBS:BOOL=ON
  BUILD_SHARED_LIBS:BOOL=ON
    
   &nbsp;
  // Don't bother building the testing tree
  // Don't bother building the testing tree
  BUILD_TESTING:BOOL=OFF
  BUILD_TESTING:BOOL=OFF
    
   &nbsp;
  // Give us an optimised release build
  // Give us an optimised release build
  CMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO
  CMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO
    
   &nbsp;
  // Install path prefix, prepended onto install directories
  // Install path prefix, prepended onto install directories
  CMAKE_INSTALL_PREFIX:PATH=/usr
  CMAKE_INSTALL_PREFIX:PATH=/usr
    
   &nbsp;
  // The code still uses the older #include <iostream.h> style
  // The code still uses the older #include <iostream.h> style
  CMAKE_CXX_FLAGS:STRING=-Wno-deprecated  
  CMAKE_CXX_FLAGS:STRING=-Wno-deprecated  
    
   &nbsp;
  // We do not want rpath enabled
  // We do not want rpath enabled
  CMAKE_SKIP_RPATH:BOOL=ON
  CMAKE_SKIP_RPATH:BOOL=ON
    
   &nbsp;
  // We haven't packaged this (yet)
  // We haven't packaged this (yet)
  ITK_DATA_ROOT:PATH=ITK_DATA_ROOT_NOTFOUND
  ITK_DATA_ROOT:PATH=ITK_DATA_ROOT_NOTFOUND
    
   &nbsp;
  // Use the system libraries for these
  // Use the system libraries for these
  ITK_USE_SYSTEM_JPEG:BOOL=ON
  ITK_USE_SYSTEM_JPEG:BOOL=ON
Line 59: Line 59:
  ITK_USE_SYSTEM_TIFF:BOOL=ON
  ITK_USE_SYSTEM_TIFF:BOOL=ON
  ITK_USE_SYSTEM_ZLIB:BOOL=ON
  ITK_USE_SYSTEM_ZLIB:BOOL=ON
    
   &nbsp;
  //Build cswig Python wrapper support
  //Build cswig Python wrapper support
  ITK_CSWIG_PYTHON:BOOL=ON
  ITK_CSWIG_PYTHON:BOOL=ON
    
   &nbsp;
  //Build cswig Tcl wrapper support
  //Build cswig Tcl wrapper support
  ITK_CSWIG_TCL:BOOL=ON
  ITK_CSWIG_TCL:BOOL=ON
Line 77: Line 77:
  //Name of build on the dashboard
  //Name of build on the dashboard
  BUILDNAME:STRING=Darwin-g++
  BUILDNAME:STRING=Darwin-g++
   
  &nbsp;
  //Build source documentation using doxygen
  //Build source documentation using doxygen
  BUILD_DOXYGEN:BOOL=OFF
  BUILD_DOXYGEN:BOOL=OFF
   
  &nbsp;
  //Build the Examples directory.
  //Build the Examples directory.
  BUILD_EXAMPLES:BOOL=OFF
  BUILD_EXAMPLES:BOOL=OFF
   
  &nbsp;
  //Build ITK with shared libraries.
  //Build ITK with shared libraries.
  BUILD_SHARED_LIBS:BOOL=ON
  BUILD_SHARED_LIBS:BOOL=ON
   
  &nbsp;
  //Build the testing tree.
  //Build the testing tree.
  BUILD_TESTING:BOOL=OFF
  BUILD_TESTING:BOOL=OFF
   
  &nbsp;
  //Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
  //Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
  // CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
  // CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
  //
  //
  CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
  CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
   
  &nbsp;
  //C++ compiler
  //C++ compiler
  CMAKE_CXX_COMPILER:STRING=g++
  CMAKE_CXX_COMPILER:STRING=g++
   
  &nbsp;
  //Use the system's jpeg library.
  //Use the system's jpeg library.
  ITK_USE_SYSTEM_JPEG:BOOL=ON
  ITK_USE_SYSTEM_JPEG:BOOL=ON
   
  &nbsp;
  //Use the system's png library.
  //Use the system's png library.
  ITK_USE_SYSTEM_PNG:BOOL=ON
  ITK_USE_SYSTEM_PNG:BOOL=ON
   
  &nbsp;
  //Use the system's tiff library.
  //Use the system's tiff library.
  ITK_USE_SYSTEM_TIFF:BOOL=ON
  ITK_USE_SYSTEM_TIFF:BOOL=ON
   
  &nbsp;
  //Use an outside build of VXL.
  //Use an outside build of VXL.
  ITK_USE_SYSTEM_VXL:BOOL=OFF
  ITK_USE_SYSTEM_VXL:BOOL=OFF
   
  &nbsp;
  //Use the system's zlib library.
  //Use the system's zlib library.
  ITK_USE_SYSTEM_ZLIB:BOOL=ON
  ITK_USE_SYSTEM_ZLIB:BOOL=ON
   
  &nbsp;
  //What is the path where the file jpeglib.h can be found
  //What is the path where the file jpeglib.h can be found
  JPEG_INCLUDE_DIR:PATH=/sw/include
  JPEG_INCLUDE_DIR:PATH=/sw/include
   
  &nbsp;
  //Where can the jpeg library be found
  //Where can the jpeg library be found
  JPEG_LIBRARY:FILEPATH=/sw/lib/libjpeg.dylib
  JPEG_LIBRARY:FILEPATH=/sw/lib/libjpeg.dylib
   
  &nbsp;
  //Where can the png library be found
  //Where can the png library be found
  PNG_LIBRARY:FILEPATH=/sw/lib/libpng.dylib
  PNG_LIBRARY:FILEPATH=/sw/lib/libpng.dylib
   
  &nbsp;
  //What is the path where the file png.h can be found
  //What is the path where the file png.h can be found
  PNG_PNG_INCLUDE_DIR:PATH=/sw/include
  PNG_PNG_INCLUDE_DIR:PATH=/sw/include
   
  &nbsp;
  //What is the path where the file tiff.h can be found
  //What is the path where the file tiff.h can be found
  TIFF_INCLUDE_DIR:PATH=/sw/include
  TIFF_INCLUDE_DIR:PATH=/sw/include
   
  &nbsp;
  //Where can the tiff library be found
  //Where can the tiff library be found
  TIFF_LIBRARY:FILEPATH=/sw/lib/libtiff.dylib
  TIFF_LIBRARY:FILEPATH=/sw/lib/libtiff.dylib
   
  &nbsp;
  //What is the path where the file zlib.h can be found
  //What is the path where the file zlib.h can be found
  ZLIB_INCLUDE_DIR:PATH=/usr/include
  ZLIB_INCLUDE_DIR:PATH=/usr/include
   
  &nbsp;
  //Where can the z library be found
  //Where can the z library be found
  ZLIB_LIBRARY:FILEPATH=/usr/lib/libz.dylib
  ZLIB_LIBRARY:FILEPATH=/usr/lib/libz.dylib

Revision as of 15:31, 23 July 2004

Configuring And Building

This page describes the various ways of configuring and building ITK in common configurations. Recommended configurations are incldued for:

  • Linux
  • Mac OS X
  • Solaris
  • AIX
  • Windows

It is strongly recommended that you build ITK in a separate tree. This is described elsewhere (?).

CMake Configuration for Linux

This configuration is the one used to build the packages for Debian GNU/Linux, but should work for any distribution just fine. It assumes that you already have certain libraries installed (which will almost always be the case), specifically:

  • libzlib
  • libjpg
  • libtiff
  • libpng

The rpath option is disabled, as it is only really needed if you install the libraries into someplace other than a standard directory that is on your LD_LIBRARY_PATH.

You can either paste this into a CMakeCache.txt or change the settings manually by running ccmake.

# This is the Kickstart CMakeCache file for the Debian build of ITK.
# Only those settings that are changed from the default are specified.
  
// For some reason it defaults to c++
CMAKE_CXX_COMPILER:STRING=g++
  
// Don't build examples now (let the user later)
BUILD_EXAMPLES:BOOL=OFF
  
// Build ITK with shared libraries
BUILD_SHARED_LIBS:BOOL=ON
  
// Don't bother building the testing tree
BUILD_TESTING:BOOL=OFF
  
// Give us an optimised release build
CMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO
  
// Install path prefix, prepended onto install directories
CMAKE_INSTALL_PREFIX:PATH=/usr
  
// The code still uses the older #include <iostream.h> style
CMAKE_CXX_FLAGS:STRING=-Wno-deprecated 
  
// We do not want rpath enabled
CMAKE_SKIP_RPATH:BOOL=ON
  
// We haven't packaged this (yet)
ITK_DATA_ROOT:PATH=ITK_DATA_ROOT_NOTFOUND
  
// Use the system libraries for these
ITK_USE_SYSTEM_JPEG:BOOL=ON
ITK_USE_SYSTEM_PNG:BOOL=ON
ITK_USE_SYSTEM_TIFF:BOOL=ON
ITK_USE_SYSTEM_ZLIB:BOOL=ON
  
//Build cswig Python wrapper support
ITK_CSWIG_PYTHON:BOOL=ON
  
//Build cswig Tcl wrapper support
ITK_CSWIG_TCL:BOOL=ON

CMake Configuration for Mac OS X

This configuration has been tested on Mac OS X Panther 10.3, with XCode 1.1 and 1.2. It presumes that Fink has been installed, with the following libraries in the default location under /sw:

  • libjpeg
  • libtiff
  • libpng
  • libzilb
//Name of build on the dashboard
BUILDNAME:STRING=Darwin-g++
 
//Build source documentation using doxygen
BUILD_DOXYGEN:BOOL=OFF
 
//Build the Examples directory.
BUILD_EXAMPLES:BOOL=OFF
 
//Build ITK with shared libraries.
BUILD_SHARED_LIBS:BOOL=ON
 
//Build the testing tree.
BUILD_TESTING:BOOL=OFF
 
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
//
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
 
//C++ compiler
CMAKE_CXX_COMPILER:STRING=g++
 
//Use the system's jpeg library.
ITK_USE_SYSTEM_JPEG:BOOL=ON
 
//Use the system's png library.
ITK_USE_SYSTEM_PNG:BOOL=ON
 
//Use the system's tiff library.
ITK_USE_SYSTEM_TIFF:BOOL=ON
 
//Use an outside build of VXL.
ITK_USE_SYSTEM_VXL:BOOL=OFF
 
//Use the system's zlib library.
ITK_USE_SYSTEM_ZLIB:BOOL=ON
 
//What is the path where the file jpeglib.h can be found
JPEG_INCLUDE_DIR:PATH=/sw/include
 
//Where can the jpeg library be found
JPEG_LIBRARY:FILEPATH=/sw/lib/libjpeg.dylib
 
//Where can the png library be found
PNG_LIBRARY:FILEPATH=/sw/lib/libpng.dylib
 
//What is the path where the file png.h can be found
PNG_PNG_INCLUDE_DIR:PATH=/sw/include
 
//What is the path where the file tiff.h can be found
TIFF_INCLUDE_DIR:PATH=/sw/include
 
//Where can the tiff library be found
TIFF_LIBRARY:FILEPATH=/sw/lib/libtiff.dylib
 
//What is the path where the file zlib.h can be found
ZLIB_INCLUDE_DIR:PATH=/usr/include
 
//Where can the z library be found
ZLIB_LIBRARY:FILEPATH=/usr/lib/libz.dylib

CMake Configuration for Solaris

CMake Configuration for AIX

CMake Configuration for Windows

Using a predefined Configuration

CMake can be run interactively to configure a build, in which case all settings begin with system defaults (as determined by CMakeLists.txt) and the user customises them.

Alternatively, a predefined configuration (such as those shown above) can be provided, which will provide initial settings for the build (also known as priming). By creating a file called CMakeCache.txt in the top level of the build directory, the settings defined therein will be used to override the default settings for the build.

Wrapping ITK

ITK can be wrapped for several different languages such as Python, Tcl and Java.