-
Notifications
You must be signed in to change notification settings - Fork 5
/
install_vtk_linux.sh
executable file
·61 lines (48 loc) · 1.37 KB
/
install_vtk_linux.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
#!/bin/bash
# cast parameter1 to lowercase
arg1=$(echo $1 | awk '{print tolower($0)}')
INITIAL_DIR=$PWD
cd "${0%/*}"
VTKLIB_DIR=$PWD/Source/ThirdParty/VtkLibrary
# check for build config
if [ "$arg1" == "debug" ]; then
VTK_BUILD_CONFIG=Debug
else
VTK_BUILD_CONFIG=Release
fi
mkdir Temporary
cd Temporary
# download vtk library (exchange for other version if needed)
curl -L "https://github.com/Kitware/VTK/archive/refs/tags/v9.3.0.rc0.tar.gz" -o download.tar.gz
tar -xf download.tar.gz
rm download.tar.gz
mv VTK-9.3.0.rc0 VTKLibrary
# if download/extraction didn't work cancel
if [ ! -d "VTKLibrary" ]; then
exit
fi
cd VTKLibrary
mkdir -p Build/$VTK_BUILD_CONFIG
mkdir -p Install/$VTK_BUILD_CONFIG
# build
printf "Doing a $VTK_BUILD_CONFIG Build."
cd Build
cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=$VTK_BUILD_CONFIG -DCMAKE_INSTALL_PREFIX=$VTKLIB_DIR/Linux/$VTK_BUILD_CONFIG \
-DVTK_GROUP_ENABLE_Rendering=DONT_WANT \
..
cmake --build . --parallel 20
cmake --install .
# move files to expected locations
mv $VTKLIB_DIR/Linux/$VTK_BUILD_CONFIG/include/vtk-9.3 $VTKLIB_DIR/Public
cd ../../..
# cleanup?
printf 'Delete the temporary build folder (./Temporary)? [Y,N]?'
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
printf 'Deleting temporary build folder...'
rm -rf Temporary
else
printf 'Keeping build folder.'
fi
cd $INITIAL_DIR