-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all.sh
executable file
·248 lines (233 loc) · 6.48 KB
/
build-all.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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/env bash
################################################################################
# Command-line help
################################################################################
print_usage_abort ()
{
cat <<EOF >&2
SYNOPSIS
${0} {Release|RelWithDebInfo|Debug} {with-gcc|without-gcc}
[cmake|gcc|boost|hwloc|jemalloc|vtk|hpx|yamlcpp|blaze|blazeIterative|flann|pcl|gmsh|nl ...]
DESCRIPTION
Download, configure, build, and install NLMech and its dependencies or
just the specified target.
EOF
exit 1
}
################################################################################
# Command-line options
################################################################################
if [[ "$1" == "Release" || "$1" == "RelWithDebInfo" || "$1" == "Debug" ]]; then
export BUILD_TYPE=$1
echo "Build Type: ${BUILD_TYPE}"
else
echo 'Build type must be provided and has to be "Release", "RelWithDebInfo", or "Debug"' >&2
print_usage_abort
fi
if [[ "$2" == "without-gcc" ]]; then
export NL_WITH_GCC=OFF
echo " Using the system gcc"
elif [[ "$2" == "with-gcc" ]]; then
export NL_WITH_GCC=ON
echo "Using the compiled gcc"
else
echo 'GCC support must be specified and has to be "with-gcc" for using the compiled gcc or "without-gcc" for using the system one' >&2
print_usage_abort
fi
while [[ -n $3 ]]; do
case $3 in
cmake)
echo 'Target cmake will build.'
export BUILD_TARGET_CMAKE=
shift
;;
gcc)
echo 'Target gcc will build.'
export BUILD_TARGET_GCC=
shift
;;
openmpi)
echo 'Target openmpi will build.'
export BUILD_TARGET_OPENMPI=
shift
;;
boost)
echo 'Target boost will build.'
export BUILD_TARGET_BOOST=
shift
;;
hwloc)
echo 'Target hwloc will build.'
export BUILD_TARGET_HWLOC=
shift
;;
jemalloc)
echo 'Target jemalloc will build.'
export BUILD_TARGET_JEMALLOC=
shift
;;
hpx)
echo 'Target hpx will build.'
export BUILD_TARGET_HPX=
shift
;;
blaze)
echo 'Target hpx will build.'
export BUILD_TARGET_BLAZE=
shift
;;
blazeIterative)
echo 'Target hpx will build.'
export BUILD_TARGET_BLAZE_ITERATIVE=
shift
;;
yamlcpp)
echo 'Target hpx will build.'
export BUILD_TARGET_YAMLCPP=
shift
;;
vtk)
echo 'Target hpx will build.'
export BUILD_TARGET_VTK=
shift
;;
flann)
echo 'Target flann will build.'
export BUILD_TARGET_FLANN=
shift
;;
pcl)
echo 'Target pcl will build.'
export BUILD_TARGET_PCL=
shift
;;
gmsh)
echo 'Target gmsh will build.'
export BUILD_TARGET_GMSH=
shift
;;
nl)
echo 'Target hpx will build.'
export BUILD_TARGET_NL=
shift
;;
*)
echo 'Unrecognizable argument passesd.' >&2
print_usage_abort
;;
esac
done
# Build all if no target(s) specified
if [[ -z ${!BUILD_TARGET_@} ]]; then
echo 'No targets specified. All targets will build.'
export BUILD_TARGET_CMAKE=
export BUILD_TARGET_GCC=
export BUILD_TARGET_OPENMPI=
export BUILD_TARGET_BOOST=
export BUILD_TARGET_HWLOC=
export BUILD_TARGET_JEMALLOC=
export BUILD_TARGET_HPX=
export BUILD_TARGET_BLAZE=
export BUILD_TARGET_BLAZE_ITERATIVE=
export BUILD_TARGET_YAMLCPP=
export BUILD_TARGET_VTK=
export BUILD_TARGET_GMSH=
export BUILD_TARGET_NL=
fi
################################################################################
# Diagnostics
################################################################################
set -e
set -x
################################################################################
# Configuration
################################################################################
# Script directory
export POWERTIGER_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
# Set Build Configuration Parameters
source config.sh
################################################################################
# Create source and installation directories
################################################################################
mkdir -p ${SOURCE_ROOT} ${INSTALL_ROOT}
################################################################################
# Build tools
################################################################################
[[ -n ${BUILD_TARGET_GCC+x} ]] && \
(
echo "Building GCC"
./build-gcc.sh
)
[[ -n ${BUILD_TARGET_CMAKE+x} ]] && \
(
echo "Building CMake"
./build-cmake.sh
)
export CMAKE_COMMAND=${INSTALL_ROOT}/cmake/bin/cmake
################################################################################
# Dependencies
################################################################################
source gcc-config.sh
[[ -n ${BUILD_TARGET_BOOST+x} ]] && \
(
echo "Building Boost"
./build-boost.sh
)
[[ -n ${BUILD_TARGET_HWLOC+x} ]] && \
(
echo "Building hwloc"
./build-hwloc.sh
)
[[ -n ${BUILD_TARGET_JEMALLOC+x} ]] && \
(
echo "Building jemalloc"
./build-jemalloc.sh
)
[[ -n ${BUILD_TARGET_HPX+x} ]] && \
(
echo "Building HPX"
./build-hpx.sh
)
[[ -n ${BUILD_TARGET_BLAZE+x} ]] && \
(
echo "Building BLAZE"
./build-blaze.sh
)
[[ -n ${BUILD_TARGET_BLAZE_ITERATIVE+x} ]] && \
(
echo "Building BLAZE ITERATIVE"
./build-blaze-iterative.sh
)
[[ -n ${BUILD_TARGET_YAMLCPP+x} ]] && \
(
echo "Building YAMLCPP"
./build-yamlcpp.sh
)
[[ -n ${BUILD_TARGET_VTK+x} ]] && \
(
echo "Building VTK"
./build-vtk.sh
)
[[ -n ${BUILD_TARGET_FLANN+x} ]] && \
(
echo "Building FLANN"
./build-flann.sh
)
[[ -n ${BUILD_TARGET_PCL+x} ]] && \
(
echo "Building PCL"
./build-pcl.sh
)
[[ -n ${BUILD_TARGET_GMSH+x} ]] && \
(
echo "Building GMSH"
./build-gmsh.sh
)
################################################################################
# NLMech
################################################################################
[[ -n ${BUILD_TARGET_NL+x} ]] && \
(
echo "Building nonlocal model framework"
./build-nl.sh
)