]> Creatis software - cpPlugins.git/blob - COMPILATION
Merge ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / COMPILATION
1 @description
2   The project uses CMake as compilation helper. It should compile on the three
3   major box flavors (linux, windows, mac). However, as of december 2014, it
4   has only been tested on linux Fedora 20 and Ubuntu 14.04.
5
6 @prerequisites
7
8   0. A decent compiler for your system:
9     Linux: g++ with c++11 support
10     Mac: Xcode
11     Windows: any Visual Studio >= 2010
12
13   1. CMake (>=2.8.12.2)
14     Just use your favorite repository or get the installer from http://www.cmake.org.
15
16   2. [Optional] Qt (=4.8)
17     On linux just install the corresponding package. On Mac and Windows, download
18     the source code and compile it with your favorite compiler. Please be aware that:
19       - Both release and debug configs are needed.
20       - Compile Qt with only SHARED support.
21       - Compile Qt without Webkit support.
22
23   3. Visualization Toolkit -VTK- (>=6.1.0)
24     1. Download VTK source code from http://www.vtk.org, copy the downloaded
25        zip/tar.gz file to your work directory (say ~/sources), uncompress the
26        source file and create an empty folder (say ~/sources/vtk-build)
27     2. Execute cmake taking care to put two directories: the source dir (where
28        the VTK source code is after decompression) and the build dir (the new
29        empty folder you just created).
30     3. On linux/mac, it is easier to execute from a command line console:
31       $ cd ~/sources/vtk-build
32       *** WARNING: IF YOU INSTALLED QT ***
33       $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
34               -DBUILD_DOCUMENTATION:BOOL=OFF \
35               -DBUILD_EXAMPLES:BOOL=OFF \
36               -DBUILD_SHARED_LIBS:BOOL=ON \
37               -DBUILD_TESTING:BOOL=OFF \
38               -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \
39               -DModule_vtkGUISupportQt:BOOL=ON \
40               -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
41               -DModule_vtkGUISupportQtSQL:BOOL=OFF \
42               -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
43               -DCMAKE_INSTALL_PREFIX:PATH=~/local \
44               ~/source/the_folder_where_vtk_was_decompressed
45       *** WARNING: IF YOU DIDN'T INSTALLED QT ***
46       $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
47               -DBUILD_DOCUMENTATION:BOOL=OFF \
48               -DBUILD_EXAMPLES:BOOL=OFF \
49               -DBUILD_SHARED_LIBS:BOOL=ON \
50               -DBUILD_TESTING:BOOL=OFF \
51               -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \
52               -DModule_vtkGUISupportQt:BOOL=OFF \
53               -DModule_vtkGUISupportQtOpenGL:BOOL=OFF \
54               -DModule_vtkGUISupportQtSQL:BOOL=OFF \
55               -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
56               -DCMAKE_INSTALL_PREFIX:PATH=~/local \
57               ~/source/the_folder_where_vtk_was_decompressed
58       $ make
59       ... WAIT A FEW MINUTES ...
60       $ make install
61     4. On windows, make sure that the following cmake variables are configured as:
62          BUILD_DOCUMENTATION:BOOL=OFF
63          BUILD_EXAMPLES:BOOL=OFF
64          BUILD_SHARED_LIBS:BOOL=ON
65          BUILD_TESTING:BOOL=OFF
66          CMAKE_BUILD_TYPE:STRING=MinSizeRel
67          Module_vtkGUISupportQt:BOOL=[OFF/ON] ** "ON", IF YOU INSTALLED Qt
68          Module_vtkGUISupportQtOpenGL:BOOL=[OFF/ON] ** "ON", IF YOU INSTALLED Qt
69          Module_vtkGUISupportQtSQL:BOOL=OFF \
70          Module_vtkGUISupportQtWebkit:BOOL=OFF \
71        NOTE: Normally, windows compilers already support c++11.
72
73   3. Insight Toolkit -ITK- (>=4.6.0)
74     1. Download ITK source code from http://www.itk.org, copy the downloaded
75        zip/tar.gz file to your work directory (say ~/sources), uncompress the
76        source file and create an empty folder (say ~/sources/itk-build)
77     2. Execute cmake taking care to put two directories: the source dir (where
78        the ITK source code is after decompression) and the build dir (the new
79        empty folder you just created).
80     3. On linux/mac, it is easier to execute from a command line console:
81       $ cd ~/sources/itk-build
82       $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
83               -DBUILD_DOCUMENTATION:BOOL=OFF \
84               -DBUILD_EXAMPLES:BOOL=OFF \
85               -DBUILD_SHARED_LIBS:BOOL=ON \
86               -DBUILD_TESTING:BOOL=OFF \
87               -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \
88               -DModule_ITKReview:BOOL=ON \
89               -DModule_ITKVtkGlue:BOOL=OFF \
90               -DCMAKE_INSTALL_PREFIX:PATH=~/local \
91               ~/source/the_folder_where_itk_was_decompressed
92       $ make
93       ... WAIT A FEW MINUTES ...
94       $ make install
95     4. On windows, make sure that the following cmake variables are configured as:
96          BUILD_DOCUMENTATION:BOOL=OFF
97          BUILD_EXAMPLES:BOOL=OFF
98          BUILD_SHARED_LIBS:BOOL=ON
99          BUILD_TESTING:BOOL=OFF
100          CMAKE_BUILD_TYPE:STRING=MinSizeRel
101          Module_ITKReview:BOOL=ON
102          Module_ITKVtkGlue:BOOL=OFF
103        NOTE: Normally, windows compilers already support c++11.
104
105   4. WARNING: Notes on compilation on MS-Windows
106      As the time being (circa dec 2014), I've been using MSVC-2013 (compiler
107      version 12). As expected, weird behavior is related to this config. Please
108      take into account the following in order to have a successful compilation:
109      4.1 If you want to build the Qt-based code, please be sure that
110          it was compiled with EXACTLY the same compiler you are using.
111      4.2 Since the dll load-unload procedure in MSWin is kind of magic,
112          VTK and ITK should be compiled as shared libraries. This allows a
113          correct execution of the SmartPointer's thus preventing anoying crashes.
114      4.3 If you found more problems in any MSWin config, please let us know at
115          florez-l@javeriana.edu.co
116
117 @compilation
118   The project uses CMake as project manager. You can use the CMake GUI to configure
119   it on your box. Please take into account the following variables:
120     USE_QT4:BOOL           -> It allows you to compile the Qt support
121     BUILD_EXAMPLES:BOOL    -> Do you want to compile the examples?
122     BUILD_SHARED_LIBRARIES -> Put this allways "ON". "OFF" is still experimental
123     CMAKE_BUILD_TYPE       -> Compilation type. Possible values: Debug, Release,
124                               MinSizeRel, RelWithDebInfo, None
125     ITK_DIR                -> Where ITK was intalled. If you followed this list,
126                               it should be on: ~/local/lib/cmake/ITK-X.Y (X and Y are
127                               the version numbers)
128     VTK_DIR                -> Where VTK was intalled. If you followed this list,
129                               it should be on: ~/local/lib/cmake/vtk-X.Y (X and Y are
130                               the version numbers)
131
132 ## eof - $RCSfile$