]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-VTK.sh
fix generation dir
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-VTK.sh
1 #!/bin/bash
2
3 echo  "in ThirdParty-onstall-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 scriptDir=$PWD
21 sourcesDir=$generationdir/thirdparty_sources
22 binDir=$generationdir/thirdparty_bin
23
24 if [ ! -e $generationdir ]
25 then
26    mkdir $generationdir
27    chown $loginUserName  $generationdir
28    chgrp $loginGroupName $generationdir
29
30 fi
31 if [ ! -e $sourcesDir ]
32 then
33    mkdir $sourcesDir
34    #was : (pb on MacOS?)
35    #chown $loginUserName:$loginGroupName $sourcesDir
36    chown $loginUserName  $sourcesDir
37    chgrp $loginGroupName $sourcesDir
38 fi
39
40 if [ ! -e $binDir ]
41 then
42    mkdir $binDir
43    chown $loginUserName  $binDir
44    chgrp $loginGroupName $binDir
45 fi
46
47   echo "we remove old stuff"
48   rm -rf $sourcesDir/VTK*
49   rm -rf $sourcesDir/vtk*
50   rm -rf $binDir/VTK*  
51   
52  cd $sourcesDir
53
54   echo "we download new stuff" 
55  if [ $OperatingSystem = "MacOS" ]
56    then     
57     curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
58     # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
59     tar -xvf VTK-5.6.1.patchCreatis.tar.gz
60    else
61     wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
62     tar -xzvf VTK-5.6.1.patchCreatis.tar.gz    
63  fi
64  
65 if [ $buildType = "Debug" ]
66 then
67    debug="ON"
68 else
69    debug="OFF"
70 fi
71
72 # the following stupid test is used at debug time; Please don't remove!
73 #if [ true = false ]
74 if [ true = true ]
75 then  
76
77   libname=VTK
78   dirInstall=$binDir/$libname-Bin
79   dirInstallVTK=$dirInstall
80   export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
81   mkdir $dirInstall
82   echo "we prepare directories dirInstallVTK " $dirInstallVTK  " VTK_DIR " $installPrefixThird/lib/vtk-5.6/
83   cd $dirInstall
84  
85   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
86   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
87   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird  CMakeCache.txt
88   
89   if [ $OperatingSystem = "MacOS" ]
90   then
91     cmake -D BUILD_SHARE_LIBS:BOOL=ON -D VTK_USE_CARBON:BOOL=ON -D  VTK_USE_COCOA:BOOL=OFF CMakeCache.txt 
92     cmake -D  VTK_USE_TCL:BOOL=OFF                                                         CMakeCache.txt  
93     cmake -D  CMAKE_CXX_COMPILER:FILE=/usr/bin/g++                                         CMakeCache.txt    
94   fi      
95   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
96   make -j $corenumber
97   make install
98   cd ..
99 fi
100