-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathinstall.sh
executable file
·122 lines (106 loc) · 3.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
#Copyright 2012, 2013
#Author Nicolas Edh,
#Nicolas.Edh@gmail.com,
#or user "nsf" at cfd-online.com
#
#License
# This file is part of hexBlocker.
#
# hexBlocker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# hexBlocker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with hexBlocker. If not, see <http://www.gnu.org/licenses/>.
#
# The license is included in the file COPYING.
#
#Description
# This script first download VTK version 5.10.0 then builds vtk and
# then builds HexBlocker.
#
set -x
# Modifyable data
baseDir=$PWD
vtkBuild=$baseDir/build/VTK
vtkInstall=$baseDir/VTK
vtkSRC=$baseDir/vtkSrc
hexBuild=$baseDir/build/hexBlocker
hexBin=$baseDir/bin
hexSRC=$baseDir/src
nprocs=4
debug="true" #set to true to build debug version aswell.
#---------------------------------------------------------------------------
# Try to find qt exes
QMAKE=$(which qmake)
MOC=$(which moc-qt4 moc | head -n1)
UIC=$(which uic-qt4 uic | head -n1)
if [ -z "$QMAKE" -o -z "$MOC" -o -z "$UIC" ]; then
echo Did not find qmake.
exit 1
fi
#Get vtk:
vtkpgk=VTK-6.3.0.tar.gz
if [ ! -f $vtkpgk ];then
wget -c http://www.vtk.org/files/release/6.3/VTK-6.3.0.tar.gz ||
( echo "could not download vtk" ; exit 1)
fi
#unpack vtk src
if [ ! -d $vtkSRC ];then
tar -xzf $vtkpgk
mv VTK-6.3.0 $vtkSRC
fi
#build VTK
if [ ! -d $vtkBuild ];then
mkdir -p $vtkBuild
cd $vtkBuild
#cmake --build --config=Release
cmake \
-DVTK_USE_GUISUPPORT:BOOL=ON \
-DVTK_USE_QT:BOOL=ON \
-DVTK_USE_QVTK:BOOL=ON \
-DVTK_Group_Qt=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=$vtkInstall \
-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY \
-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY \
$vtkSRC || (echo "error in cmake, VTK"; exit 1)
make -j $nprocs || (echo "error in make, VTK"; exit 1)
make install
fi
#Build HexBlocker
cd $baseDir
mkdir -p $hexBuild
cd $hexBuild
cmake \
-DVTK_DIR=$vtkInstall/lib/cmake/vtk-6.3 \
-DQT_QMAKE_EXECUTABLE=$QMAKE \
-DQT_MOC_EXECUTABLE=$MOC \
-DQT_UIC_EXECUTABLE=$UIC \
-DCMAKE_INSTALL_PREFIX=$hexBin \
$hexSRC || (echo "error in cmake for hexBlocker";exit 1)
make -j $nprocs || (echo "error in make for hexBlocker";exit 1)
make install
#Buil debug version (optional)
if [ $debug == "true" ];then
mkdir -p $hexBuild-dbg
cd $hexBuild-dbg
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DVTK_DIR=$vtkInstall/lib/cmake/vtk-6.3 \
-DQT_QMAKE_EXECUTABLE=$QMAKE \
-DQT_MOC_EXECUTABLE=$MOC \
-DQT_UIC_EXECUTABLE=$UIC \
-DCMAKE_INSTALL_PREFIX=$hexBin \
$hexSRC || (echo "error in cmake for hexBlocker";exit 1)
make -j $nprocs || (echo "error in make for hexBlocker";exit 1)
make install
fi
exit 0