]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
61ba301a8e980026b5269cf74739a015ed39ffef
[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 #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
52
53 if [ ! -e $generationdir ]
54 then
55    mkdir $generationdir
56    chown $loginUserName  $generationdir
57    chgrp $loginGroupName $generationdir
58
59 fi
60 if [ ! -e $sourcesDir ]
61 then
62    mkdir $sourcesDir
63    #was : (pb on MacOS?)
64    #chown $loginUserName:$loginGroupName $sourcesDir
65    chown $loginUserName  $sourcesDir
66    chgrp $loginGroupName $sourcesDir
67 fi
68
69 if [ ! -e $binDir ]
70 then
71    mkdir $binDir
72    chown $loginUserName  $binDir
73    chgrp $loginGroupName $binDir
74 fi
75
76   echo "we remove old stuff"
77   if [ $ITKVersion = ITK3 ]
78   then
79      rm -rf $sourcesDir/InsightToolkit*
80      rm -rf $binDir/InsightToolkit*
81   else
82      rm -rf $sourcesDir/ITK*
83      rm -rf $binDir/ITKt*
84   fi
85   cd $sourcesDir
86
87  echo "we download new stuff"
88   if [ $ITKVersion = ITK3 ]
89   then
90      # deal with ITK3
91      #EED itkfile=InsightToolkit-3.20.0.patchCreatis.tar.gz
92      #EED libname=InsightToolkit-3.20.0
93      itkfile=InsightToolkit-3.20.1.tar.gz
94      libname=InsightToolkit-3.20.1
95   else
96     # deal with ITK4
97     itkfile=ITK4.0.tgz
98     libname=ITK
99   fi
100
101   if [ $OperatingSystem = "MacOS" ]
102     then
103       curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/$itkfile
104   else
105       wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/$itkfile
106   fi
107   tar -xzvf $itkfile
108
109
110 #fi # JPR ------------1
111
112 if [ $buildType = "Debug" ]
113 then
114    debug="ON"
115 else
116    debug="OFF"
117 fi
118
119 # the following stupid test is used at debug time; Please don't remove!
120 #if [ true = false ]
121 if [ true = true ]
122 then
123
124   dirInstall=$binDir/$libname-Bin
125   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
126   mkdir $dirInstall
127   cd $dirInstall
128
129   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
130   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
131   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
132   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
133   if [ $ITKVersion = ITK4 ]
134   then
135      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        
136   fi
137   #uncomment following line if you want to use the bleeding edge of GDCM2!
138   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
139   cmake CMakeCache.txt
140   make -j $corenumber
141   make install
142   cd ..
143 fi