-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildDep
212 lines (201 loc) · 6.17 KB
/
buildDep
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/bash
_skipBuild=0
_skipDownload=0
usage() { echo "$0 usage:" && grep " .)\ #" $0; exit 0; }
[ $# -eq 0 ] && usage
while getopts ":i:n:ho:bd" opt; do
case ${opt} in
h) # Display help
usage
;;
i) # Specify the prefix for install (_installPrefix)
_installPrefix=${OPTARG}
if [[ "$_installPrefix" != /* ]]; then
echo "Please specify relative path starting with /"
exit 0
fi
;;
n) # Specify the number of build processes (_nProcs)
_nProcs=$OPTARG
;;
o) # Build [ all ] or only one dependency [ openmesh openvolumemesh gmsh moab ]
_dep=$OPTARG
;;
b) # Skip build
_skipBuild=1
;;
d) # Skip download
_skipDownload=1
;;
\?)
echo "Invalid option: $OPTARG" 1>&2
exit
;;
:)
echo "Option ${OPTARG} requires an argument" 1>&2
exit
;;
esac
done
shift $((OPTIND -1))
echo "#"
echo "# _installPrefix=${_installPrefix}"
echo "# _nProcs=${_nProcs}"
echo "# _dep=${_dep}"
echo "# _skipBuild=${_skipBuild}"
echo "# _skipDownload=${_skipDownload}"
echo "#"
# create directory
mkdir -p ThirdParty
_patch=`pwd`
_patch=${_patch}/ThirdParty.patch
cd ThirdParty
_pwd=`pwd`
#-------------------------------------------------------------------------------
# OpenMesh
#-------------------------------------------------------------------------------
echo "# Build OpenMesh ..."
if [[ "$_dep" == "openmesh" || "$_dep" == "all" ]]; then
cd $_pwd
if [[ "$_skipDownload" == "0" ]]; then
rm -rf OpenMesh-8.1.tar.gz
curl -o OpenMesh-8.1.tar.gz https://www.graphics.rwth-aachen.de/media/openmesh_static/Releases/8.1/OpenMesh-8.1.tar.gz
fi
if [[ "$_skipBuild" == "0" ]]; then
rm -rf build_OpenMesh-8.1 OpenMesh-8.1
tar xfz OpenMesh-8.1.tar.gz
mkdir -p ${_pwd}/build_OpenMesh-8.1
cd ${_pwd}/build_OpenMesh-8.1
cmake \
-DCMAKE_INSTALL_PREFIX=${_installPrefix} \
../OpenMesh-8.1
make -j${_nProcs} install
fi
else
echo "# ...skip"
fi
#-------------------------------------------------------------------------------
# OpenVolumeMesh
#-------------------------------------------------------------------------------
echo "# Build OpenVolumeMesh ..."
if [[ "$_dep" == "openvolumemesh" || "$_dep" == "all" ]]; then
cd $_pwd
if [[ "$_skipDownload" == "0" ]]; then
rm -rf OpenVolumeMesh
git clone https://github.com/nTopology/OpenVolumeMesh.git OpenVolumeMesh
fi
if [[ "$_skipBuild" == "0" ]]; then
rm -rf build_OpenVolumeMesh
mkdir -p ${_pwd}/build_OpenVolumeMesh
cd ${_pwd}/build_OpenVolumeMesh
cmake \
-DCMAKE_INSTALL_PREFIX=${_installPrefix} \
-DCMAKE_BUILD_TYPE=Release \
../OpenVolumeMesh
make -j${_nProcs} install
fi
else
echo "# ...skip"
fi
#-------------------------------------------------------------------------------
# gmsh
#-------------------------------------------------------------------------------
echo "# Build gmsh ..."
if [[ "$_dep" == "gmsh" || "$_dep" == "all" ]]; then
cd $_pwd
if [[ "$_skipDownload" == "0" ]]; then
rm -rf ${_pwd}/gmsh
git clone https://gitlab.onelab.info/gmsh/gmsh.git gmsh
cd ${_pwd}/gmsh
git checkout gmsh_4_8_1
fi
if [[ "$_skipBuild" == "0" ]]; then
rm -rf ${_pwd}/build_gmsh
cd ${_pwd}/gmsh
if [[ -z "$(git status CMakeLists.txt | grep modified)" ]]; then
echo "Modify CMakeLists.txt"
sed -e "s%file(GLOB_RECURSE HEADERS Common%file(GLOB_RECURSE HEADERS Parser/*.h Common%g" -i CMakeLists.txt
fi
if [[ -z "$(git status Geo/GEntity.h | grep modified)" ]]; then
echo "Modify Geo/GEntity.h"
sed '/^.*GModel \*model.*$/a\ \ void setModel( GModel * model ) { _model = model; }' -i Geo/GEntity.h
fi
if [[ -z "$(git status Geo/MVertex.h | grep modified)" ]]; then
echo "Modify Geo/MVertex.h"
sed '/^.*getNum\(\).*const.*$/a\ \ inline void setNum(int const num) { _num = num; }' -i Geo/MVertex.h
fi
if [[ -z "$(git status Mesh/meshGEdge.cpp | grep modified)" ]]; then
echo "Modify Mesh/meshGEdge.cpp"
sed -e "s%static void copyMesh%void copyMesh%g" -i Mesh/meshGEdge.cpp
fi
if [[ -z "$(git status Mesh/meshGFace.cpp | grep modified)" ]]; then
echo "Modify Mesh/meshGFace.cpp"
sed -e "s%static void copyMesh%void copyMesh%g" -i Mesh/meshGFace.cpp
fi
mkdir -p ${_pwd}/build_gmsh
cd ${_pwd}/build_gmsh
cmake \
-DCMAKE_INSTALL_PREFIX=${_installPrefix} \
-DENABLE_BUILD_SHARED=ON \
-DENABLE_PRIVATE_API=ON \
-DENABLE_SOLVER=OFF \
-DENABLE_GETDP=OFF \
-DENABLE_GMM=OFF \
-DENABLE_GMP=OFF \
-DENABLE_KBIPACK=OFF \
-DENABLE_METIS=OFF \
-DENABLE_MPEG_ENCODE=OFF \
-DENABLE_ONELAB_METAMODEL=OFF \
-DENABLE_PRO=OFF \
-DENABLE_DOMHEX=OFF \
-DENABLE_HXT=OFF \
-DENABLE_CGNS=OFF \
-DENABLE_MATHEX=OFF \
-DENABLE_MED=OFF \
-DENABLE_MMG=OFF \
-DENABLE_OCC=OFF \
-DENABLE_OCC_CAF=OFF \
-DENABLE_QUADTRI=OFF \
-DBUILD_TESTING=OFF \
../gmsh
# FLTK, POST, PLUGINS, ONELAB necessary for GUI
# -DENABLE_FLTK=OFF \
# -DENABLE_POST=OFF \
# -DENABLE_PLUGINS=OFF \
# -DENABLE_ONELAB=OFF \
make -j${_nProcs} install
fi
else
echo "# ...skip"
fi
#-------------------------------------------------------------------------------
# moab
#-------------------------------------------------------------------------------
echo "# Build moab ..."
if [[ "$_dep" == "moab" || "$_dep" == "all" ]]; then
cd $_pwd
if [[ "$_skipDownload" == "0" ]]; then
rm -rf moab
git clone https://bitbucket.org/fathomteam/moab.git moab
fi
if [[ "$_skipBuild" == "0" ]]; then
cd ${_pwd}/moab
if [[ -z "$(git status src/io/ReadCGNS.cpp | grep modified)" ]]; then
echo "Modify src/io/ReadCGNS.cpp"
patch src/io/ReadCGNS.cpp < ${_patch}/patch.ReadCGNS.cpp
fi
mkdir -p ${_pwd}/build_moab
cd ${_pwd}/build_moab
cmake \
-DCMAKE_INSTALL_PREFIX=${_installPrefix} \
-DENABLE_CGM=OFF \
-DENABLE_CGNS=ON \
-DCMAKE_SHARED_LINKER_FLAGS=-lcgns \
-DENABLE_HDF5=ON \
-DCMAKE_CXX_FLAGS=-I/usr/include/hdf5/serial \
../moab
make -j${_nProcs} install
fi
else
echo "# ...skip"
fi