]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
Forcing the compiler must be done *before* any else
[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
18 source $PWD/scripts/CreaTools-configure.sh
19
20    echo "------"
21    echo $PWD/scripts/CreaTools-configure.sh
22    echo --generationdir--
23    echo $generationdir
24    echo --docgeneration--
25    echo $docgeneration
26    echo --installPrefix--
27    echo $installPrefix
28    echo --installPrefixThird--
29    echo $installPrefixThird
30    echo --buildType--
31    echo $buildType
32    echo --gdcmVersion--
33    echo $gdcmVersion
34 #   echo --sourcesFrom--
35 #   echo $sourcesFrom
36 #   echo --scriptDir--
37 #   echo $scriptDir
38 #   echo --start_point--
39 #   echo $start_point
40    echo "------"
41
42
43 scriptDir=$PWD
44 sourcesDir=$generationdir/thirdparty_sources
45 binDir=$generationdir/thirdparty_bin
46
47 if [ ! -e $generationdir ]
48 then
49    mkdir $generationdir
50    chown $loginUserName  $generationdir
51    chgrp $loginGroupName $generationdir
52
53 fi
54 if [ ! -e $sourcesDir ]
55 then
56    mkdir $sourcesDir
57    #was : (pb on MacOS?)
58    #chown $loginUserName:$loginGroupName $sourcesDir
59    chown $loginUserName  $sourcesDir
60    chgrp $loginGroupName $sourcesDir
61 fi
62
63 if [ ! -e $binDir ]
64 then
65    mkdir $binDir
66    chown $loginUserName  $binDir
67    chgrp $loginGroupName $binDir
68 fi
69
70   echo "we remove old stuff"
71   rm -rf $sourcesDir/InsightToolkit*
72   rm -rf $binDir/InsightToolkit*
73
74   cd $sourcesDir
75
76  echo "we download new stuff"
77  if [ $OperatingSystem = "MacOS" ]
78  then
79   curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
80   # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
81   tar -xvf InsightToolkit-3.20.0.tar.gz
82  else
83   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
84   tar -xzvf InsightToolkit-3.20.0.tar.gz
85  fi
86
87 if [ $buildType = "Debug" ]
88 then
89    debug="ON"
90 else
91    debug="OFF"
92 fi
93
94 # the following stupid test is used at debug time; Please don't remove!
95 #if [ true = false ]
96 if [ true = true ]
97 then
98   libname=InsightToolkit-3.20.0
99   dirInstall=$binDir/$libname-Bin
100   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
101   mkdir $dirInstall
102   cd $dirInstall
103
104   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
105   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
106   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
107   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
108   #uncomment following line if you want to use the bleeding edge of GDCM2!
109   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
110   cmake CMakeCache.txt
111   make -j $corenumber
112   make install
113   cd ..
114 fi