updates to ParaView build scripts

This commit is contained in:
andy
2008-05-27 16:21:30 +01:00
parent 6277b6da7a
commit 96b1c70043
2 changed files with 109 additions and 81 deletions

View File

@ -28,48 +28,42 @@
#
# Description
# Build and install ParaView
# - run from folder above source folder
# - run from folder above ParaView source folder or place the
# ParaView source under $WM_PROJECT_INST_DIR
#
#------------------------------------------------------------------------------
set -x
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
. $WM_PROJECT_DIR/bin/buildParaViewFunctions
# set -x
PARAVIEW_SRC="ParaView3.3-cvs"
PARAVIEW_MAJOR_VERSION="3.2"
PARAVIEW_MAJOR_VERSION="3.3"
VERBOSE="OFF"
INCLUDE_MPI="ON"
VERBOSE=OFF
INCLUDE_MPI=ON
MPI_MAX_PROCS=32
INCLUDE_PYTHON="ON"
INCLUDE_PYTHON=ON
#PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
PYTHON_LIBRARY=""
INCLUDE_MESA="OFF"
INCLUDE_MESA=OFF
set +x
# provide a shortcut for repeated builds - use with caution
if [ "$#" -gt 0 ]
then
CMAKE_SKIP=YES
fi
initialiseVariables
# set MPI specific options
if [ "$INCLUDE_MPI" = "ON" ]; then
addMpiSupport
fi
# set python specific options
if [ "$INCLUDE_PYTHON" = "ON" ]; then
addPythonSupport
fi
# set MESA specific options
if [ "$INCLUDE_MESA" = "ON" ]; then
addMesaSupport
fi
addMpiSupport # set MPI specific options
addPythonSupport # set python specific options
addMesaSupport # set MESA specific options
buildParaView
installParaView
# finalisation
cd $PWD
echo "done."
echo "done"
#------------------------------------------------------------------------------

View File

@ -31,32 +31,30 @@
#
#------------------------------------------------------------------------------
addCMakeVariable ()
{
while [ -n "$1" ]
do
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
shift
done
}
initialiseVariables ()
{
CMAKE_VARIABLES=""
PWD=`pwd`
OBJ_ADD=""
unset CMAKE_VARIABLES OBJ_ADD
if [ "$VERBOSE" = "ON" ]; then
if [ "$VERBOSE" = ON ]; then
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
fi
}
addCMakeVariable ()
{
if [ -z "$1" ]; then
echo "*** Error: addCMakeVariable()"
echo " No variable to add"
exit 1
fi
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
}
addMpiSupport ()
{
[ "$INCLUDE_MPI" = ON ] || return
# using OpenFOAM variables to identify location of MPI libraries
case "$WM_MPLIB" in
OPENMPI)
@ -75,8 +73,11 @@ addMpiSupport ()
MPI_RUN=$MPICH_ARCH_PATH/bin/mpirun
;;
*)
echo "*** Error: unknown/unsupported mpi: $WM_MPLIB"
exit 1
;;
esac
if [ "$INCLUDE_MPI" ]; then
OBJ_ADD="$OBJ_ADD-mpi"
addCMakeVariable "VTK_USE_MPI=ON"
addCMakeVariable "PARAVIEW_USE_MPI=ON"
@ -84,15 +85,13 @@ addMpiSupport ()
addCMakeVariable "MPI_LIBRARY=$MPI_LIBRARY"
addCMakeVariable "VTK_MPIRUN_EXE=$MPI_RUN"
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
else
echo "*** Error: unknown/unsupported mpi: $WM_MPLIB"
exit 1
fi
}
addPythonSupport ()
{
[ "$INCLUDE_PYTHON" = ON ] || return
WHICH_PYTHON=`which python`
if [ -n "$WHICH_PYTHON" ]; then
OBJ_ADD="$OBJ_ADD-py"
@ -139,6 +138,8 @@ addPythonSupport ()
addMesaSupport ()
{
[ "$INCLUDE_MESA" = ON ] || return
MESA_INCLUDE_DIR=/usr/include/GL
MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
@ -157,13 +158,39 @@ addMesaSupport ()
buildParaView ()
{
# set general options
addCmakeVariable "DBUILD_SHARED_LIBS:BOOL=ON"
addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON"
# set paraview environment
PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC
#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD
unset PARAVIEW_SRC_DIR
for i in $PWD $WM_PROJECT_INST_DIR
do
if [ -d $i/$PARAVIEW_SRC ]
then
PARAVIEW_SRC_DIR=$i/$PARAVIEW_SRC
break
fi
done
[ -d "$PARAVIEW_SRC_DIR" ] || {
echo "did not find $PARAVIEW_SRC in these directories:"
echo " PWD=$PWD"
echo " WM_PROJECT_INST_DIR=$WM_PROJECT_INST_DIR"
echo "abort build"
exit 1
}
# PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD
PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS
# provide a shortcut for repeated builds - use with caution
if [ "$CMAKE_SKIP" = YES ]
then
# change to build folder
cd $PARAVIEW_OBJ_DIR || exit 1
else
# remove existing build folder if present
if [ -e "$PARAVIEW_OBJ_DIR" ]; then
rm -rf $PARAVIEW_OBJ_DIR
@ -181,8 +208,6 @@ buildParaView ()
echo " Target : $PARAVIEW_OBJ_DIR"
# make paraview
# provide a backdoor to skip cmake for repeated builds
if [ -z "$build_no_cmake" ]; then
cmake \
-DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
$CMAKE_VARIABLES \
@ -217,7 +242,7 @@ installParaView ()
-print
# create a softlink to the $PARAVIEW_OBJ_DIR/bin folder
# - work-around for chosen install location
# - workaround for chosen install location
echo " Creating paraview $PARAVIEW_MAJOR_VERSION soft link to /bin"
( mkdir lib && cd lib && ln -s ../bin \
paraview-$PARAVIEW_MAJOR_VERSION )
@ -231,7 +256,16 @@ installParaView ()
echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR"
echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN"
echo " Add $PARAVIEW_OBJ_DIR/bin to PATH"
#echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
# echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
echo " ---"
fi
}
# for good measure - clear a few variables before using any of the functions
unset VERBOSE INCLUDE_MPI INCLUDE_PYTHON INCLUDE_MESA PYTHON_LIBRARY
unset CMAKE_VARIABLES OBJ_ADD
unset CMAKE_SKIP
#------------------------------------------------------------------------------