]> Creatis software - cpPlugins.git/blob - config/install_ivq.sh
6e37f043f719bc6903551f731a07bca24fffb794
[cpPlugins.git] / config / install_ivq.sh
1 #!/bin/bash
2
3 ## -- Command line options
4 while [[ "$#" -gt 1 ]]; do
5     key="$1"
6     case $key in
7         -qt)
8         qt="$2"
9         shift
10         ;;
11         -cmake)
12         cmake="$2"
13         shift
14         ;;
15         -vtk)
16         vtk="$2"
17         shift
18         ;;
19         -itk)
20         itk="$2"
21         shift
22         ;;
23         -prefix)
24         prefix="$2"
25         shift
26         ;;
27         -suffix)
28         suffix="$2"
29         shift
30         ;;
31         -build_dir)
32         build_dir="$2"
33         shift
34         ;;
35         -cores)
36         cores="$2"
37         shift
38         ;;
39         *)
40         # Do nothing
41         ;;
42     esac
43     shift
44 done
45
46 ## -- Check command line options
47 if \
48     [ -z "$prefix" ] || \
49     [ -z "$qt" ] || \
50     [ -z "$cmake" ] || \
51     [ -z "$vtk" ] || \
52     [ -z "$itk" ] ; then
53     (>&2 echo "Usage: $0 -prefix [dir] -qt [dir] -cmake [dir] -vtk [dir] -itk [dir] [-build_dir [dir]] [-suffix [string]] [-cores [n]]")
54     exit 1
55 fi
56
57 ## -- Complete optional parameters
58 if [ -z "$cores" ] ; then
59     cores="1"
60 fi
61 if [ -z "$build_dir" ] ; then
62     build_dir="$HOME/.tmp"
63 fi
64 if [ ! -z "$suffix" ] ; then
65     qt_suffix="-qtlibinfix $suffix"
66 fi
67 curr_dir=`pwd`
68
69 ## -- Configure, build and install Qt5
70 mkdir -p $build_dir/qt
71 cd $build_dir/qt
72 $qt/configure \
73     -prefix $prefix -shared -confirm-license -opensource -release \
74     -c++std c++11 -opengl desktop \
75     -nomake examples -nomake tests -no-harfbuzz \
76     -qt-xcb -qt-xkbcommon -qt-pcre \
77     -skip qt3d  -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity \
78     -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad \
79     -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation \
80     -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing \
81     -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript \
82     -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport \
83     -skip qtspeech -skip qtsvg -skip qttranslations -skip qtvirtualkeyboard \
84     -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets \
85     -skip qtwebview -skip qtxmlpatterns $qt_suffix
86 make -s -j$cores -k
87 make -s -j -k install
88
89 ## -- Configure, build and install CMake
90 mkdir -p $build_dir/cmake
91 cd $build_dir/cmake
92 $cmake/bootstrap --parallel=$cores --prefix=$prefix --no-qt-gui
93 make -s -j$cores -k
94 make -s -j -k install
95
96 ## -- Configure, build and install VTK
97 cd $vtk
98 patch -s -p1 < $curr_dir/vtk.patch
99 mkdir -p $build_dir/vtk
100 cd $build_dir/vtk
101 $prefix/bin/cmake \
102     -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
103     -DBUILD_SHARED_LIBS:BOOL=ON \
104     -DCMAKE_BUILD_TYPE:STRING=Release \
105     -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
106     -DBUILD_DOCUMENTATION:BOOL=OFF \
107     -DBUILD_EXAMPLES:BOOL=OFF \
108     -DBUILD_TESTING:BOOL=OFF \
109     -DVTK_Group_Qt:BOOL=ON \
110     -DVTK_QT_VERSION:STRING=5 \
111     -DQt5_DIR:PATH=$prefix/lib/cmake/Qt5 \
112     -DQT_QMAKE_EXECUTABLE:PATH=$prefix/bin/qmake \
113     -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
114     -DCMAKE_DEBUG_POSTFIX:STRING=$suffix \
115     -DCMAKE_RELEASE_POSTFIX:STRING=$suffix \
116     -DCMAKE_MACOSX_RPATH:BOOL=ON \
117     $vtk
118 make -s -j$cores -k
119 make -s -j -k install
120
121 ## -- Configure, build and install VTK
122 mkdir -p $build_dir/itk
123 cd $build_dir/itk
124 $prefix/bin/cmake \
125     -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
126     -DBUILD_SHARED_LIBS:BOOL=ON \
127     -DCMAKE_BUILD_TYPE:STRING=Release \
128     -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
129     -DBUILD_DOCUMENTATION:BOOL=OFF \
130     -DBUILD_EXAMPLES:BOOL=OFF \
131     -DBUILD_TESTING:BOOL=OFF \
132     -DModule_ITKReview:BOOL=ON \
133     -DModule_ITKVtkGlue:BOOL=ON \
134     -DCMAKE_DEBUG_POSTFIX:STRING=$suffix \
135     -DCMAKE_RELEASE_POSTFIX:STRING=$suffix \
136     -DCMAKE_MACOSX_RPATH:BOOL=ON \
137     $itk
138 make -s -j$cores -k
139 make -s -j -k install
140
141 ## -- cpPlugins
142 mkdir -p $build_dir/cpPlugins
143 cd $build_dir/cpPlugoms
144 $prefix/bin/cmake \
145     -DCMAKE_BUILD_TYPE:STRING=Release \
146     -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
147     -DcpPlugins_BUID:BOOL=ON \
148     -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
149     -DcpPlugins_BUILD_ivq:BOOL=ON \
150     -DcpPlugins_BUILD_tclap:BOOL=ON \
151     -DITK_DIR:PATH=$prefix/lib/cmake/ITK-4.12 \
152     -DVTK_DIR:PATH=$prefix/lib/cmake/ \
153     $cpPlugins
154 make -s -j$cores -k
155 make -s -j -k install
156
157
158 ## -- End
159 cd $curr_dir
160
161 ## eof - $RCSfile$