]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-ITK.sh
9a8f3e3b66b30cf6856c63cfc308b9bbf9aa9ce1
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-ITK.sh
1 #!/bin/bash
2  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
3  then 
4    echo
5    echo "..ERROR.."
6    echo "==================================================="
7    echo "REMEMBER !"
8    echo ""
9    echo "YOU NEED TO RUN 'Configure' (0) First !"
10    echo "==================================================="
11    echo
12    echo
13    exit 0
14 fi
15
16
17 scriptDir=$PWD
18 sourcesDir=$generationdir/thirdparty_sources
19 binDir=$generationdir/thirdparty_bin
20
21 if [ ! -e $generationdir ]
22 then
23    mkdir $generationdir
24    chown $loginUserName  $generationdir
25    chgrp $loginGroupName $generationdir
26
27 fi
28 if [ ! -e $sourcesDir ]
29 then
30    mkdir $sourcesDir
31    #was : (pb on MacOS?)
32    #chown $loginUserName:$loginGroupName $sourcesDir
33    chown $loginUserName  $sourcesDir
34    chgrp $loginGroupName $sourcesDir
35 fi
36
37 if [ ! -e $binDir ]
38 then
39    mkdir $binDir
40    chown $loginUserName  $binDir
41    chgrp $loginGroupName $binDir
42 fi
43
44   echo "we remove old stuff"
45   rm -rf $sourcesDir/InsightToolkit*
46   
47  cd $sourcesDir
48  
49  if [ $OperatingSystem = "MacOS" ]
50    then     
51     curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz    # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
52     tar -xvf InsightToolkit-3.20.0.tar.gz
53    else
54     wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
55  fi
56  
57 if [ $buildType = "Debug" ]
58 then
59    debug="ON"
60 else
61    debug="OFF"
62 fi
63
64 # the following stupid test is used at debug time; Please don't remove!
65 #if [ true = false ]
66 if [ true = true ]
67 then
68   libname=InsightToolkit-3.20.0
69   dirInstall=$binDir/$libname-Bin
70   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
71   mkdir $dirInstall
72   cd $dirInstall
73   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
74   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
75   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
76   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
77   #uncomment following line if you want to use the bleeding edge of GDCM2!
78   #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
79   cmake CMakeCache.txt
80   make -j $corenumber
81   make install
82   cd ..
83 fi
84