]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-VTK.sh
36ac0308439e775faf0b6e9c390c18bc2d0857e7
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-VTK.sh
1 #!/bin/bash
2
3  echo  "in ThirdParty-install-VTK.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/VTK*
72   rm -rf $sourcesDir/vtk*
73   rm -rf $binDir/VTK*
74
75   cd $sourcesDir
76
77  echo "we download new stuff"
78  if [ $OperatingSystem = "MacOS" ]
79  then
80   curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
81   # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
82   tar -xvf VTK-5.6.1.patchCreatis.tar.gz
83  else
84   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
85   tar -xzvf VTK-5.6.1.patchCreatis.tar.gz
86  fi
87
88 if [ $buildType = "Debug" ]
89 then
90    debug="ON"
91 else
92    debug="OFF"
93 fi
94
95 # the following stupid test is used at debug time; Please don't remove!
96 #if [ true = false ]
97 if [ true = true ]
98 then
99   libname=VTK
100   dirInstall=$binDir/$libname-Bin
101   export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
102   mkdir $dirInstall
103   echo "we prepare directories dirInstall " $dirInstall  " VTK_DIR " $installPrefixThird/lib/vtk-5.6/
104   cd $dirInstall
105
106 # See EED why we have to do this
107   if [ $OperatingSystem = "MacOS" ]
108   then
109      cmake -D  CMAKE_CXX_COMPILER:FILE=/usr/bin/g++
110   fi
111   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
112   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
113   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
114
115   if [ $OperatingSystem = "MacOS" ]
116   then
117     cmake -D BUILD_SHARE_LIBS:BOOL=ON -D VTK_USE_CARBON:BOOL=ON -D  VTK_USE_COCOA:BOOL=OFF CMakeCache.txt
118     cmake -D  VTK_USE_TCL:BOOL=OFF                                                         CMakeCache.txt
119     CMakeCache.txt
120   fi
121
122   cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D VTK_USE_QT:BOOL=ON CMakeCache.txt
123   make -j $corenumber
124   make install
125   cd ..
126 fi