]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
3405 vtk8itk5wx3-macos
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-ITK.sh
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
4 #                        pour la Santé)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 #
7 #  This software is governed by the CeCILL-B license under French law and 
8 #  abiding by the rules of distribution of free software. You can  use, 
9 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
10 #  license as circulated by CEA, CNRS and INRIA at the following URL 
11 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
12 #  or in the file LICENSE.txt.
13 #
14 #  As a counterpart to the access to the source code and  rights to copy,
15 #  modify and redistribute granted by the license, users are provided only
16 #  with a limited warranty  and the software's author,  the holder of the
17 #  economic rights,  and the successive licensors  have only  limited
18 #  liability. 
19 #
20 #  The fact that you are presently reading this means that you have had
21 #  knowledge of the CeCILL-B license and that you accept its terms.
22 # ------------------------------------------------------------------------  
23
24
25 #!/bin/bash
26
27  echo  "in ThirdParty-install-ITK.sh, source " $PWD/scripts/CreaTools-configure.sh
28  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
29  then 
30    echo
31    echo "..ERROR.."
32    echo "==================================================="
33    echo "REMEMBER !"
34    echo ""
35    echo "YOU NEED TO RUN 'Configure' (0) First !"
36    echo "==================================================="
37    echo
38    echo
39    exit 0
40 fi
41
42 source $PWD/scripts/CreaTools-configure.sh
43
44    echo "------"
45    echo $PWD/scripts/CreaTools-configure.sh
46    echo --generationdir--
47    echo $generationdir
48    echo --docgeneration--
49    echo $docgeneration
50    echo --installPrefix--
51    echo $installPrefix
52    echo --installPrefixThird--
53    echo $installPrefixThird
54    echo --buildType--
55    echo $buildType
56    echo --gdcmVersion--
57    echo $gdcmVersion
58    echo --ITKVersion--
59    echo $ITKVersion
60 #   echo --sourcesFrom--
61 #   echo $sourcesFrom
62 #   echo --scriptDir--
63 #   echo $scriptDir
64 #   echo --start_point--
65 #   echo $start_point
66    echo "------"
67
68
69 #EED 2017-03-24
70   source $PWD/scripts/LocalFunctions.sh
71   if [ `getDistrib` == "CentOS" ] && [ `getKernelVersion` < "2.6.34" ]
72   then
73         stdCompiler=c++98
74   else
75         stdCompiler=c++11
76   fi
77
78
79
80 scriptDir=$PWD
81 sourcesDir=$generationdir/thirdparty_sources
82 binDir=$generationdir/thirdparty_bin
83 #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
84
85 if [ ! -e $generationdir ]
86 then
87    mkdir -p $generationdir
88    chown -R $loginUserName  $generationdir
89    chgrp -R $loginGroupName $generationdir
90
91 fi
92 if [ ! -e $sourcesDir ]
93 then
94    mkdir -p $sourcesDir
95    #was : (pb on MacOS?)
96    #chown -R $loginUserName:$loginGroupName $sourcesDir
97    chown -R $loginUserName  $sourcesDir
98    chgrp -R $loginGroupName $sourcesDir
99 fi
100
101 if [ ! -e $binDir ]
102 then
103    mkdir -p $binDir
104    chown -R $loginUserName  $binDir
105    chgrp -R $loginGroupName $binDir
106 fi
107
108   echo "we remove old stuff"
109   if [ $ITKVersion = ITK3 ]
110   then
111      rm -rf $sourcesDir/InsightToolkit*
112      rm -rf $binDir/InsightToolkit*
113   else
114      rm -rf $sourcesDir/ITK*
115      rm -rf $binDir/ITKt*
116   fi
117   cd $sourcesDir
118
119  echo "we download new stuff"
120 #  if [ $ITKVersion = ITK3 ]
121 #  then
122 #     # deal with ITK3
123 #     #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
124 #     #EED libname=InsightToolkit-3.20.0
125 #
126 #     #EED itkfile=InsightToolkit-3.20.1.tar.gz
127 #     #EED libname=InsightToolkit-3.20.1
128 #
129 #     itkfile=InsightToolkit-3.20.1-patchCreatis.tgz
130 #     libname=InsightToolkit-3.20.1-patchCreatis
131 #
132 #  else
133 #    # deal with ITK4
134 #    itkfile=InsightToolkit-4.13.1.zip
135 #    libname=InsightToolkit-4.13.1
136 #  fi
137
138     itkfile=InsightToolkit-5.0.1.zip
139     libname=InsightToolkit-5.0.1
140
141
142 ##  if [ $OperatingSystem = "MacOS" ]
143 ##    then
144 ##      curl -O http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
145 ##  else
146 ## ##EED19mai2015      wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/$itkfile
147 ##      wget http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
148 ## ##  tar -xzvf $itkfile
149 ##  fi
150
151   wget http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
152   unzip  $itkfile
153
154
155 #fi # JPR ------------1
156
157 #if [ $buildType = "Debug" ]
158 #then
159 #   debug="ON"
160 #else
161 #   debug="OFF"
162 #fi
163
164 # the following stupid test is used at debug time; Please don't remove!
165 #if [ true = false ]
166 if [ true = true ]
167 then
168
169   dirInstall=$binDir/$libname-Bin
170   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
171   mkdir -p $dirInstall
172   cd $dirInstall
173
174   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
175   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
176   cmake -D CMAKE_BUILD_TYPE:STRING=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
177   cmake -D BUILD_SHARED_LIBS:BOOL=ON -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF CMakeCache.txt
178 #  if [ $ITKVersion = ITK3 ]
179 #  then
180 #    cmake -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
181 #  fi
182 #  if [ $ITKVersion = ITK4 ]
183 #  then
184 ###EED ITK4.0
185 ##     cmake -D ITKV3_COMPATIBILITY:BOOL=ON -D ITKGroup_Nonunit:BOOL=ON -D  ITKGroup_IO:BOOL=ON  -D Module_ITK-Deprecated:BOOL=ON -D Module_ITK-Review:BOOL=ON  CMakeCache.txt        
186 #
187 ###EED ITK4.12
188 ## -D ITK_USE_SYSTEM_GDCM=ON
189 #     cmake -D ITKV3_COMPATIBILITY:BOOL=ON -D Module_ITKReview:BOOL=ON  CMakeCache.txt        
190 #  fi
191  
192    cmake -D Module_ITKReview:BOOL=ON  CMakeCache.txt     
193    cmake -D CMAKE_CXX_FLAGS:STRING=-std=${stdCompiler} CMakeCache.txt
194
195   #uncomment following line if you want to use the bleeding edge of GDCM2!
196   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
197   cmake CMakeCache.txt
198   make -j $corenumber
199   make -j $corenumber install
200   cd ..
201 fi