]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
#3044 creaToolsTools Bug New Normal - Fedora 24 ThirdParty library conflict with...
[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 scriptDir=$PWD
73 sourcesDir=$generationdir/thirdparty_sources
74 binDir=$generationdir/thirdparty_bin
75 #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
76
77 if [ ! -e $generationdir ]
78 then
79    mkdir -p $generationdir
80    chown -R $loginUserName  $generationdir
81    chgrp -R $loginGroupName $generationdir
82
83 fi
84 if [ ! -e $sourcesDir ]
85 then
86    mkdir -p $sourcesDir
87    #was : (pb on MacOS?)
88    #chown -R $loginUserName:$loginGroupName $sourcesDir
89    chown -R $loginUserName  $sourcesDir
90    chgrp -R $loginGroupName $sourcesDir
91 fi
92
93 if [ ! -e $binDir ]
94 then
95    mkdir -p $binDir
96    chown -R $loginUserName  $binDir
97    chgrp -R $loginGroupName $binDir
98 fi
99
100   echo "we remove old stuff"
101   if [ $ITKVersion = ITK3 ]
102   then
103      rm -rf $sourcesDir/InsightToolkit*
104      rm -rf $binDir/InsightToolkit*
105   else
106      rm -rf $sourcesDir/ITK*
107      rm -rf $binDir/ITKt*
108   fi
109   cd $sourcesDir
110
111  echo "we download new stuff"
112   if [ $ITKVersion = ITK3 ]
113   then
114      # deal with ITK3
115      #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
116      #EED libname=InsightToolkit-3.20.0
117
118      #EED itkfile=InsightToolkit-3.20.1.tar.gz
119      #EED libname=InsightToolkit-3.20.1
120
121      itkfile=InsightToolkit-3.20.1-patchCreatis.tgz
122      libname=InsightToolkit-3.20.1-patchCreatis
123
124   else
125     # deal with ITK4
126     itkfile=ITK4.0.tgz
127     libname=ITK
128   fi
129
130   if [ $OperatingSystem = "MacOS" ]
131     then
132       curl -O http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
133   else
134 ##EED19mai2015      wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/$itkfile
135       wget http://www.creatis.insa-lyon.fr/~davila/creatools_back_site/crea_ThirdParty_Libraries/source/$itkfile
136   fi
137   tar -xzvf $itkfile
138
139
140 #fi # JPR ------------1
141
142 #if [ $buildType = "Debug" ]
143 #then
144 #   debug="ON"
145 #else
146 #   debug="OFF"
147 #fi
148
149 # the following stupid test is used at debug time; Please don't remove!
150 #if [ true = false ]
151 if [ true = true ]
152 then
153
154   dirInstall=$binDir/$libname-Bin
155   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
156   mkdir -p $dirInstall
157   cd $dirInstall
158
159   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
160   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
161   cmake -D CMAKE_BUILD_TYPE:STRING=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
162   cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
163   if [ $ITKVersion = ITK4 ]
164   then
165      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        
166   fi
167   cmake -D CMAKE_CXX_FLAGS:STRING='-std=c++03' CMakeCache.txt
168
169   #uncomment following line if you want to use the bleeding edge of GDCM2!
170   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
171   cmake CMakeCache.txt
172   make -j $corenumber
173   make -j $corenumber install
174   cd ..
175 fi