]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/scripts/install_thirdparty_all.sh
Allow choosing OperatingSystem
[creaToolsTools.git] / Install_ThirdParty / scripts / install_thirdparty_all.sh
1
2 #!/bin/sh
3
4 if [ $# = 0 ]
5 then
6   echo "Use it as :"
7   echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
8   echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}" 
9   echo " "
10   echo "ex : sh install_thirdparty_all.sh /tmp/gendir ~/Creatis/myInstallDirectory Debug Ubuntu"
11   exit 0
12 fi
13
14 echo $#
15 echo "----------"
16 echo $0
17 echo $1
18 echo $2
19 echo $3
20 echo $4
21 echo "----------"
22
23 if [ $# != 4 ]
24 then 
25   echo "Use it as :"
26   echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
27   echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}" 
28   echo " "
29   echo "ex : sh install_thirdparty_all.sh /tmp/gendir ~/Creatis/myInstallDirectory Debug Ubuntu"
30   exit 0
31 fi
32
33
34 generationdir=$1
35 installPrefix=$2
36 buildType=$3
37 OS=$4
38
39 scriptDir=$PWD
40 sourcesDir=$generationdir/thirdparty_sources
41 binDir=$generationdir/thirdparty_bin
42
43 mkdir $generationdir
44 mkdir $sourcesDir
45 mkdir $binDir
46
47 # the following stupid test is used at debug time; Please don't remove!
48 if [ true = true ]
49 then
50
51   case $OS in
52   Fedora)
53      sudo yum install cmake -y 
54      sudo yum install cmake-gui -y 
55      sudo yum install doxygen -y
56      sudo yum install graphviz -y
57      sudo yum install texlive -y
58      sudo yum install latex2html -y
59      sudo yum install wxGTK-devel wxBase -y
60      sudo yum install boost-devel -y
61      sudo yum install sqlite-devel -y
62      sudo yum install qt-devel -y
63      sudo yum install mesa-libOSMesa-devel -y
64      ;;
65   Ubuntu)  
66      sudo apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
67      sudo apt-get --yes install cmake
68      sudo apt-get --yes install cmake-gui
69      sudo apt-get --yes install cmake-curses-gui
70      sudo apt-get --yes install doxygen
71      sudo apt-get --yes install graphviz
72      sudo apt-get --yes install texlive
73      sudo apt-get --yes install latex2html
74      sudo apt-get --yes install libgtk2.0-dev #GTK
75      sudo apt-get --yes install libwxgtk2.8-dev #Wx GTK
76      sudo apt-get --yes install libwxbase2.8-dev #Wx solito
77      sudo apt-get --yes install libboost-dev  #Boost
78      sudo apt-get --yes install libboost-all-dev #Boost
79      sudo apt-get --yes install libqt4-dev #QT4
80      sudo apt-get --yes install sqlite
81      sudo apt-get --yes install libosmesa6-dev #Mesa6
82      sudo apt-get --yes install uuid-dev # uuid para la instalacion de itk
83      sudo apt-get --yes install libxaw7-dev # X11
84      ;;
85   MacOS)
86      echo "MacOS not yet dealt with ..."
87      exit 0
88      ;;
89   *)
90      echo " '$OS' : Unknown (for us...) Operating Sytem "
91      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
92      exit 0
93      ;;
94   esac             
95 fi
96
97
98
99 # the following stupid test is used at debug time; Please don't remove!
100 if [ true = true ]
101 then
102   rm -rf $sources/VTK*
103   rm -rf $sources/vtk*
104   rm -rf $sources/InsightToolkit*
105   rm -rf $sources/gdcm*
106   cd $sourcesDir
107   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
108   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
109   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
110   tar -xvzf vtk-5.6.1.tar.gz
111   tar -xvzf gdcm_08_Dic_2009.tar.gz
112   tar -xvzf InsightToolkit-3.20.0.tar.gz
113 fi
114
115
116
117 if [ $buildType = "Debug" ]
118 then
119 debug="ON"
120 else
121 debug="OFF"
122 fi
123
124
125 if [ true = true ]
126 then
127   libname=VTK
128   dirInstall=$binDir/$libname-Bin
129   dirInstallVTK=$dirInstall
130   mkdir $dirInstall
131   cd $dirInstall
132   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
133   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
134   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
135   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
136   make -j 2
137   sudo make install
138   cd ..
139 fi
140
141 if [ true = true ]
142 then
143   libname=gdcm
144   dirInstall=$binDir/$libname-Bin
145   mkdir $dirInstall
146   cd $dirInstall
147   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
148   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
149   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
150   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
151   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
152   make -j 2
153   sudo make install
154   cd ..
155 fi
156
157 if [ true = true ]
158 then
159   libname=InsightToolkit-3.20.0
160   dirInstall=$binDir/$libname-Bin
161   mkdir $dirInstall
162   cd $dirInstall
163   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
164   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
165   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
166   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
167   cmake CMakeCache.txt
168   make -j 2
169   sudo make install
170   cd ..
171 fi
172
173