Merge branch 'master' of github.com:OpenCFD/OpenFOAM-2.0.x
[OpenFOAM-2.0.x.git] / etc / config / paraview.sh
blob9ffd68d284df1f610ea2398c5d15325f6f60432b
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
6 # \\/ M anipulation |
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 # File
25 # config/paraview.sh
27 # Description
28 # Setup file for paraview-3.x
29 # Sourced from OpenFOAM-<VERSION>/etc/bashrc or from foamPV alias
31 # Note
32 # The env. variables 'ParaView_DIR' and 'ParaView_MAJOR'
33 # are required for building plugins
34 #------------------------------------------------------------------------------
36 # clean the PATH
37 cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` && PATH="$cleaned"
39 # determine the cmake to be used
40 unset CMAKE_HOME
41 for cmake in cmake-2.8.4 cmake-2.8.3 cmake-2.8.1
43 cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
44 if [ -r $cmake ]
45 then
46 export CMAKE_HOME=$cmake
47 export PATH=$CMAKE_HOME/bin:$PATH
48 break
50 done
53 #- ParaView version, automatically determine major version
54 export ParaView_VERSION=3.10.1
55 export ParaView_MAJOR=detect
58 # Evaluate command-line parameters for ParaView
59 _foamParaviewEval()
61 while [ $# -gt 0 ]
63 case "$1" in
64 ParaView*=*)
65 # name=value -> export name=value
66 eval "export $1"
68 esac
69 shift
70 done
73 # Evaluate command-line parameters
74 _foamParaviewEval $@
77 # set MAJOR version to correspond to VERSION
78 # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
79 case "$ParaView_VERSION" in
80 "$ParaView_MAJOR".* )
81 # version and major appear to correspond
84 [0-9]*)
85 # extract major from the version
86 ParaView_MAJOR=`echo $ParaView_VERSION | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
88 esac
89 export ParaView_VERSION ParaView_MAJOR
91 paraviewInstDir=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
92 export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION
94 # set paths if binaries or source are present
95 if [ -r $ParaView_DIR -o -r $paraviewInstDir ]
96 then
97 export PATH=$ParaView_DIR/bin:$PATH
98 export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH
99 export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
101 # add in python libraries if required
102 paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
103 if [ -r $paraviewPython ]
104 then
105 if [ "$PYTHONPATH" ]
106 then
107 export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_DIR/lib/paraview-$ParaView_MAJOR
108 else
109 export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/paraview-$ParaView_MAJOR
112 else
113 unset PV_PLUGIN_PATH
116 unset _foamParaviewEval
117 unset cleaned cmake paraviewInstDir paraviewPython
119 # -----------------------------------------------------------------------------