-
Notifications
You must be signed in to change notification settings - Fork 58
/
makeParaView
executable file
·358 lines (322 loc) · 9.41 KB
/
makeParaView
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM 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.
#
# OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# makeParaView
#
# Description
# Make and install paraview 4 or 5
# - place the paraview source under $WM_THIRD_PARTY_DIR/ParaView-VERSION
# (note capitalisation)
#
#------------------------------------------------------------------------------
# run from third-party directory only
cd ${0%/*} || exit 1
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
. $WM_PROJECT_DIR/etc/config.sh/functions
. etc/tools/ThirdPartyFunctions
. etc/tools/ParaViewFunctions
#------------------------------------------------------------------------------
#
# USER OPTIONS:
# ~~~~~~~~~~~~~
# MPI support:
withMPI=false
MPI_MAX_PROCS=32
# Python support:
withPYTHON=false
# OSMESA graphics support:
withOSMESA=false
OSMESA_INCLUDE="/usr/include/GL"
OSMESA_LIBRARY="/usr/lib64/libOSMesa.so"
# extra QT gui support (useful for some third party apps)
withQT=true
# Set the path to the qmake
QMAKE_PATH=""
# Set the path to cmake
CMAKE_PATH=""
#
# NO FURTHER EDITING BELOW THIS LINE
#
#-----------------------------------------------------------------------------
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [OPTION] [CMAKE-OPTION]
options:
-rebuild for repeated builds (-make -install) *use with caution*
-osmesa with osmesa (if not already enabled)
-mpi with mpi (if not already enabled)
-python with python (if not already enabled)
-cmake PATH with the cmake version corresponding to the cmake path given
-qmake PATH with the Qt version corresponding to the qmake path given
-qt with extra Qt gui support (if not already enabled)
-qt-VER with Qt version corresponding to
\$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake
-gcc force g++ instead of the value from \$WM_CXX
-verbose verbose output in Makefiles
-version VER specify an alternative version (current value: $ParaView_VERSION)
-major VER specify an alternative major version for special builds
-osmesa-include DIR
location of osmesa headers (current value: ${OSMESA_INCLUDE:-none})
-osmesa-lib PATH path to osmesa library (current value: ${OSMESA_LIBRARY:-none})
-help
The -no-FEATURE option can be disable these features (if not already disabled):
osmesa mpi python qt
CMake options start with a capital letter and contain an '='.
For example,
$Script BUILD_TESTING=ON
to add tests
For finer control, the build stages can be selected or deselected individually:
-config -no-config
-make -no-make
-install -no-install
* Make and install ParaView-$ParaView_VERSION located under
\$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
-> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION
USAGE
exit 1
}
#------------------------------------------------------------------------------
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CC" ] && export CC="$WM_CC"
#
# add options based on script name:
#
case "$Script" in *-osmesa*) withOSMESA=true;; esac
case "$Script" in *-mpi*) withMPI=true;; esac
case "$Script" in *-python*) withPYTHON=true;; esac
case "$Script" in *-qt*) withQT=true;; esac
# set ParaView_MAJOR based on current value of ParaView_VERSION (if any)
setVersion
#
# various building stages
#
unset runCONFIG runMAKE runINSTALL
runDEFAULT=true
buildType=Release
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
paraview-*)
setVersion "${2##paraview-*}"
shift 2
;;
ParaView-*)
setVersion "${2##ParaView-*}"
shift 2
;;
[A-Z]*=*) # cmake variables
addCMakeVariable "$1"
shift
;;
-gcc)
export CXX=g++ # use g++
shift
;;
-config) # stage 1: config only
runCONFIG=true
unset runDEFAULT
shift
;;
-no-config)
runCONFIG=false
shift
;;
-make) # stage 2: make only
runMAKE=true
unset runDEFAULT
shift
;;
-no-make)
runMAKE=false
shift
;;
-install) # stage 3: install only
runINSTALL=true
unset runDEFAULT
shift
;;
-no-install)
runINSTALL=false
shift
;;
-rebuild) # shortcut for rebuilding
runMAKE=true
runINSTALL=true
unset runDEFAULT
shift
;;
-osmesa)
withOSMESA=true
shift
;;
-no-osmesa)
withOSMESA=false
shift
;;
-osmesa-include)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
OSMESA_INCLUDE="$2"
shift 2
;;
-osmesa-lib)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
OSMESA_LIBRARY="$2"
shift 2
;;
-mpi)
withMPI=true
shift
;;
-no-mpi)
withMPI=false
shift
;;
-python)
withPYTHON=true
shift
;;
-no-python)
withPYTHON=false
shift
;;
-cmake)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
CMAKE_PATH=$2
shift 2
;;
-qmake)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
QMAKE_PATH=$2
shift 2
;;
-qt)
withQT=true
shift
;;
-no-qt)
withQT=false
shift
;;
-qt-[1-9]*)
QMAKE_PATH="$installBASE/${1##-}"
shift
;;
-verbose)
withVERBOSE=true
shift
;;
-version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
setVersion "$2"
shift 2
;;
-major)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
export ParaView_MAJOR="$2"
shift 2
;;
-buildType)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
buildType="$2"
shift 2
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
# If we don't have a version, then try to detect it
if [ -z "$ParaView_VERSION" ]
then
ParaView_SOURCE_DIR=$(_foamMostRecentDir ParaView-*)
if [ -d "$ParaView_SOURCE_DIR" ]
then
setVersion "${ParaView_SOURCE_DIR##*ParaView-}"
fi
fi
# If we still don't have a version, then quit, asking the user to specify one
if [ -z "$ParaView_VERSION" ]
then
ParaView_VERSION=?.?.?
usage "The version was not specified on the command line, set in the OpenFOAM
configuration, or detected on disk. Specify a version with '-version VER'."
fi
if [ "$runDEFAULT" = true ]
then
: ${runCONFIG:=true}
: ${runMAKE:=true}
: ${runINSTALL:=true}
fi
# Download ParaView sources
#~~~~~~~~~~~~~~~~~~~~~~~~~~
downloadParaView || usage "ParaView download failed. Re-run to retry download"
# Set configure options
#~~~~~~~~~~~~~~~~~~~~~~
addVerbosity # verbose makefiles
addMpiSupport # set MPI-specific options
addPythonSupport # set Python-specific options
addOSMesaSupport # set OSMESA-specific options
addQtSupport # add extra Qt support
setDirs # where things are or should be put
# Build and install
# ~~~~~~~~~~~~~~~~~
cat<<SUMMARY
Build stages selected
---------------------
-config ${runCONFIG:-false}
-make ${runMAKE:-false}
-install ${runINSTALL:-false}
---------------------
Features selected
osmesa ${withOSMESA:-false}
mpi ${withMPI:-false}
python ${withPYTHON:-false}
qt ${withQT:-false}
---------------------
Version information
qt ${QtVersion:-none}
version ${ParaView_VERSION:-unknown}
major ${ParaView_MAJOR:-unknown}
build ${buildType:-Release}
---------------------
SUMMARY
[ "$runCONFIG" = true ] && configParaView
[ "$runMAKE" = true ] && makeParaView
[ "$runINSTALL" = true ] && installParaView
echo
echo Done
#------------------------------------------------------------------------------