]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
#3405 creaToolsTools Feature New Normal - 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 echo $PWD/scripts/CreaTools-configure.sh
42 echo --- beg
43 more $PWD/scripts/CreaTools-configure.sh
44 echo --- end
45 source $PWD/scripts/CreaTools-configure.sh
46
47    echo "------"
48    echo $PWD/scripts/CreaTools-configure.sh
49    echo --generationdir--
50    echo $generationdir
51    echo --docgeneration--
52    echo $docgeneration
53    echo --installPrefix--
54    echo $installPrefix
55    echo --installPrefixThird--
56    echo $installPrefixThird
57    echo --buildType--
58    echo $buildType
59    echo --gdcmVersion--
60    echo $gdcmVersion
61    echo --ITKVersion--
62    echo $ITKVersion
63 #   echo --sourcesFrom--
64 #   echo $sourcesFrom
65 #   echo --scriptDir--
66 #   echo $scriptDir
67 #   echo --start_point--
68 #   echo $start_point
69    echo "------"
70
71
72 #EED 2017-03-24
73   source $PWD/scripts/LocalFunctions.sh
74   if [ `getDistrib` == "CentOS" ] && [ `getKernelVersion` < "2.6.34" ]
75   then
76         stdCompiler=c++98
77   else
78         stdCompiler=c++11
79   fi
80
81
82
83 scriptDir=$PWD
84 sourcesDir=$generationdir/thirdparty_sources
85 binDir=$generationdir/thirdparty_bin
86 #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
87
88 if [ ! -e $generationdir ]
89 then
90    mkdir -p $generationdir
91    chown -R $loginUserName  $generationdir
92    chgrp -R $loginGroupName $generationdir
93
94 fi
95 if [ ! -e $sourcesDir ]
96 then
97    mkdir -p $sourcesDir
98    #was : (pb on MacOS?)
99    #chown -R $loginUserName:$loginGroupName $sourcesDir
100    chown -R $loginUserName  $sourcesDir
101    chgrp -R $loginGroupName $sourcesDir
102 fi
103
104 if [ ! -e $binDir ]
105 then
106    mkdir -p $binDir
107    chown -R $loginUserName  $binDir
108    chgrp -R $loginGroupName $binDir
109 fi
110
111   echo "we remove old stuff"
112   if [ $ITKVersion = ITK3 ]
113   then
114      rm -rf $sourcesDir/InsightToolkit*
115      rm -rf $binDir/InsightToolkit*
116   else
117      rm -rf $sourcesDir/ITK*
118      rm -rf $binDir/ITKt*
119   fi
120   cd $sourcesDir
121
122  echo "we download new stuff"
123 #  if [ $ITKVersion = ITK3 ]
124 #  then
125 #     # deal with ITK3
126 #     #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
127 #     #EED libname=InsightToolkit-3.20.0
128 #
129 #     #EED itkfile=InsightToolkit-3.20.1.tar.gz
130 #     #EED libname=InsightToolkit-3.20.1
131 #
132 #     itkfile=InsightToolkit-3.20.1-patchCreatis.tgz
133 #     libname=InsightToolkit-3.20.1-patchCreatis
134 #
135 #  else
136 #    # deal with ITK4
137 #    itkfile=InsightToolkit-4.13.1.zip
138 #    libname=InsightToolkit-4.13.1
139 #  fi
140
141     itkfile=InsightToolkit-5.0.1.zip
142     libname=InsightToolkit-5.0.1
143
144
145 ##  if [ $OperatingSystem = "MacOS" ]
146 ##    then
147 ##      curl -O http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
148 ##  else
149 ## ##EED19mai2015      wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/$itkfile
150 ##      wget http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
151 ## ##  tar -xzvf $itkfile
152 ##  fi
153
154   wget http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
155   unzip  $itkfile
156
157
158 #fi # JPR ------------1
159
160 #if [ $buildType = "Debug" ]
161 #then
162 #   debug="ON"
163 #else
164 #   debug="OFF"
165 #fi
166
167 # the following stupid test is used at debug time; Please don't remove!
168 #if [ true = false ]
169 if [ true = true ]
170 then
171
172   dirInstall=$binDir/$libname-Bin
173   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
174   mkdir -p $dirInstall
175   cd $dirInstall
176
177   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
178   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
179   cmake -D CMAKE_BUILD_TYPE:STRING=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
180   cmake -D BUILD_SHARED_LIBS:BOOL=ON -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF CMakeCache.txt
181 #  if [ $ITKVersion = ITK3 ]
182 #  then
183 #    cmake -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
184 #  fi
185 #  if [ $ITKVersion = ITK4 ]
186 #  then
187 ###EED ITK4.0
188 ##     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        
189 #
190 ###EED ITK4.12
191 ## -D ITK_USE_SYSTEM_GDCM=ON
192 #     cmake -D ITKV3_COMPATIBILITY:BOOL=ON -D Module_ITKReview:BOOL=ON  CMakeCache.txt        
193 #  fi
194  
195    cmake -D Module_ITKReview:BOOL=ON  CMakeCache.txt     
196    cmake -D CMAKE_CXX_FLAGS:STRING=-std=${stdCompiler} CMakeCache.txt
197
198   #uncomment following line if you want to use the bleeding edge of GDCM2!
199   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
200   cmake CMakeCache.txt
201   make -j $corenumber
202   make -j $corenumber install
203   cd ..
204 fi