]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
Fix comment;
[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   rm -rf $sourcesDir/InsightToolkit*
77   rm -rf $binDir/InsightToolkit*
78
79   cd $sourcesDir
80
81  echo "we download new stuff"
82  if [ $OperatingSystem = "MacOS" ]
83  then
84   curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
85   # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
86   tar -xvf InsightToolkit-3.20.0.tar.gz
87  else
88   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
89   tar -xzvf InsightToolkit-3.20.0.tar.gz
90  fi
91
92 if [ $buildType = "Debug" ]
93 then
94    debug="ON"
95 else
96    debug="OFF"
97 fi
98
99 # the following stupid test is used at debug time; Please don't remove!
100 #if [ true = false ]
101 if [ true = true ]
102 then
103   libname=InsightToolkit-3.20.0
104   dirInstall=$binDir/$libname-Bin
105   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
106   mkdir $dirInstall
107   cd $dirInstall
108
109   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
110   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
111   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
112   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
113   #uncomment following line if you want to use the bleeding edge of GDCM2!
114   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
115   cmake CMakeCache.txt
116   make -j $corenumber
117   make install
118   cd ..
119 fi