]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
858c58313e0e5ff66f2fbd1057e9efe70f5b0ee7
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-ITK.sh
1 #!/bin/bash
2
3  echo  "in ThirdParty-install-ITK.sh, source " $PWD/scripts/CreaTools-configure.sh
4  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
5  then 
6    echo
7    echo "..ERROR.."
8    echo "==================================================="
9    echo "REMEMBER !"
10    echo ""
11    echo "YOU NEED TO RUN 'Configure' (0) First !"
12    echo "==================================================="
13    echo
14    echo
15    exit 0
16 fi
17 echo $PWD/scripts/CreaTools-configure.sh
18 echo --- beg
19 more $PWD/scripts/CreaTools-configure.sh
20 echo --- end
21 source $PWD/scripts/CreaTools-configure.sh
22
23    echo "------"
24    echo $PWD/scripts/CreaTools-configure.sh
25    echo --generationdir--
26    echo $generationdir
27    echo --docgeneration--
28    echo $docgeneration
29    echo --installPrefix--
30    echo $installPrefix
31    echo --installPrefixThird--
32    echo $installPrefixThird
33    echo --buildType--
34    echo $buildType
35    echo --gdcmVersion--
36    echo $gdcmVersion
37    echo --ITKVersion--
38    echo $ITKVersion
39 #   echo --sourcesFrom--
40 #   echo $sourcesFrom
41 #   echo --scriptDir--
42 #   echo $scriptDir
43 #   echo --start_point--
44 #   echo $start_point
45    echo "------"
46
47
48 scriptDir=$PWD
49 sourcesDir=$generationdir/thirdparty_sources
50 binDir=$generationdir/thirdparty_bin
51
52 if [ ! -e $generationdir ]
53 then
54    mkdir $generationdir
55    chown $loginUserName  $generationdir
56    chgrp $loginGroupName $generationdir
57
58 fi
59 if [ ! -e $sourcesDir ]
60 then
61    mkdir $sourcesDir
62    #was : (pb on MacOS?)
63    #chown $loginUserName:$loginGroupName $sourcesDir
64    chown $loginUserName  $sourcesDir
65    chgrp $loginGroupName $sourcesDir
66 fi
67
68 if [ ! -e $binDir ]
69 then
70    mkdir $binDir
71    chown $loginUserName  $binDir
72    chgrp $loginGroupName $binDir
73 fi
74
75   echo "we remove old stuff"
76   if [ $ITKVersion = ITK3 ]
77   then
78      rm -rf $sourcesDir/InsightToolkit*
79      rm -rf $binDir/InsightToolkit*
80   else
81      rm -rf $sourcesDir/ITK*
82      rm -rf $binDir/ITKt*
83   fi
84   cd $sourcesDir
85
86  echo "we download new stuff"
87   if [ $ITKVersion = ITK3 ]
88   then
89   #  deal with ITK3
90      if [ $OperatingSystem = "MacOS" ]
91      then
92         curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.patchCreatis.tar.gz
93      else
94         wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.patchCreatis.tar.gz
95      fi
96      tar -xzvf InsightToolkit-3.20.0.tar.gz
97   else
98     #  deal with ITK4
99     if [ $OperatingSystem = "MacOS" ]
100     then
101        curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/ITK4.0.tgz
102     else
103        wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/ITK4.0.tgz
104     fi
105     tar -xzvf ITK4.0.tgz
106   fi
107
108 #fi # JPR ------------1
109
110 if [ $buildType = "Debug" ]
111 then
112    debug="ON"
113 else
114    debug="OFF"
115 fi
116
117 # the following stupid test is used at debug time; Please don't remove!
118 #if [ true = false ]
119 if [ true = true ]
120 then
121   if [ $ITKVersion = ITK3 ]
122   then
123      libname=InsightToolkit-3.20.0
124   else
125      libname=ITK
126   fi
127
128   dirInstall=$binDir/$libname-Bin
129   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
130   mkdir $dirInstall
131   cd $dirInstall
132
133   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
134   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
135   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
136   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
137   if [ $ITKVersion = ITK4 ]
138   then
139      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        
140   fi
141   #uncomment following line if you want to use the bleeding edge of GDCM2!
142   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
143   cmake CMakeCache.txt
144   make -j $corenumber
145   make install
146   cd ..
147 fi