]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-VTK.sh
split ThirdParty-install.sh into elementary steps
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-VTK.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/VTK*
46   rm -rf $sourcesDir/vtk*
47   rm -rf $binDir/VTK*  
48   
49  cd $sourcesDir
50  
51  if [ $OperatingSystem = "MacOS" ]
52    then     
53     curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
54     # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
55     tar -xvf VTK-5.6.1.patchCreatis.tar.gz
56    else
57     wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
58  fi
59  
60 if [ $buildType = "Debug" ]
61 then
62    debug="ON"
63 else
64    debug="OFF"
65 fi
66
67 # the following stupid test is used at debug time; Please don't remove!
68 #if [ true = false ]
69 if [ true = true ]
70 then
71   libname=VTK
72   dirInstall=$binDir/$libname-Bin
73   dirInstallVTK=$dirInstall
74   export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
75   mkdir $dirInstall
76   cd $dirInstall
77  
78   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
79   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
80   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird  CMakeCache.txt
81   
82   if [ $OperatingSystem = "MacOS" ]
83   then
84     cmake -D BUILD_SHARE_LIBS:BOOL=ON -D VTK_USE_CARBON:BOOL=ON -D  VTK_USE_COCOA:BOOL=OFF CMakeCache.txt 
85     cmake -D  VTK_USE_TCL:BOOL=OFF                                                         CMakeCache.txt  
86     cmake -D  CMAKE_CXX_COMPILER:FILE=/usr/bin/g++                                         CMakeCache.txt    
87   fi      
88   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
89   make -j $corenumber
90   make install
91   cd ..
92 fi
93