Commit ecab02b5 authored by mark's avatar mark
Browse files

DEFEATURE: remove make scripts for paraview 3.x (issue #9)

- With paraview 3.14 (Feb 2012) and paraview 3.98 (Dec 2012)
  experience unresolvable build issues. Can no longer compile.
parent 06b4a315
#---------------------------------*- sh -*-------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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/>.
#
# File
# etc/tools/ParaViewFunctions
#
# Description
# ParaView make/install helper functions
#
#------------------------------------------------------------------------------
# buildBASE, installBASE defined from tools/ThirdPartyFunctions
#
# Where things are or should be put
# ParaView_VERSION and ParaView_MAJOR should already have been set
#
# ParaView_SOURCE_DIR : location of the original sources
# ParaView_BINARY_DIR : location of the build
# ParaView_DIR : location of the installed program
#
setParaViewDirs()
{
ParaView_SOURCE_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
[ -d "$ParaView_SOURCE_DIR" ] || {
echo "did not find ParaView-$ParaView_VERSION in these directories:"
echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
echo
echo "abort build"
exit 1
}
# ParaView_BINARY_DIR=$buildBASE/ParaView-$ParaView_VERSION${OBJ_ADD:+-$OBJ_ADD}
ParaView_BINARY_DIR=$buildBASE/ParaView-$ParaView_VERSION
# ParaView_DIR=$installBASE/ParaView-$ParaView_VERSION${OBJ_ADD:+-$OBJ_ADD}
ParaView_DIR=$installBASE/ParaView-$ParaView_VERSION
export ParaView_SOURCE_DIR ParaView_BINARY_DIR ParaView_DIR
echo
echo "ParaView_SOURCE_DIR=$ParaView_SOURCE_DIR"
echo "ParaView_BINARY_DIR=$ParaView_BINARY_DIR"
echo "ParaView_DIR=$ParaView_DIR"
# Forcefully override the .git path for the ParaView source code directory
export GIT_DIR=$ParaView_SOURCE_DIR/.git
}
#
# Set ParaView_VERSION and adjust ParaView_MAJOR accordingly
#
# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0
#
setParaViewVersion()
{
[ $# -gt 0 ] || {
echo "Error: function setParaViewVersion() called without an argument"
exit 1
}
ParaView_VERSION="${1##*-}"
# The major version is "<digits>.<digits>"
ParaView_MAJOR=$(echo $ParaView_VERSION | \
sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
export ParaView_VERSION ParaView_MAJOR
}
#------------------------------------------------------------------------------
#
# Compare version information (specified vs what is found in CMakeLists.txt)
# Parse this type of content:
# set (PARAVIEW_VERSION_FULL "3.98.1")
#
checkVersion()
{
local ver=$(
sed -ne 's/^ *set *( *PARAVIEW_VERSION_FULL[ "]*\([.0-9]*\).*$/\1/ip' \
$ParaView_SOURCE_DIR/CMakeLists.txt
)
if [ "$ParaView_VERSION" != "$ver" ]
then
echo "MISMATCH!"
echo " specified $ParaView_VERSION"
echo " found ${ver:-NONE}"
fi
}
#
# Set CMake cache variables
#
addCMakeVariable()
{
while [ -n "$1" ]
do
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
shift
done
}
#
# Verbose makefiles
#
addVerbosity()
{
if [ "${withVERBOSE:=false}" = true ]
then
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
fi
}
#
# Define options for mpi support
#
addMpiSupport()
{
if [ "${withMPI:=false}" != true ]
then
return
fi
OBJ_ADD="$OBJ_ADD-mpi"
addCMakeVariable "PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON"
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
}
#
# Define options for python support
#
addPythonSupport()
{
if [ "${withPYTHON:=false}" != true ]
then
return
fi
OBJ_ADD="$OBJ_ADD-py"
if pythonBin=$(which python 2>/dev/null)
then
if [ -n "$PYTHON_LIBRARY" ]
then
# Check $PYTHON_LIBRARY if it has been set
if [ ! -e "$PYTHON_LIBRARY" ]
then
echo "*** Error: libpython not found at location specified " \
"by -pythnon-lib input: PYTHON_LIBRARY=$PYTHON_LIBRARY"
fi
else
# Try to get $PYTHON_LIBRARY from dynamically linked binary
PYTHON_LIBRARY=$(ldd $pythonBin | \
sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
[ -e "$PYTHON_LIBRARY" ] || {
echo "*** Error: Unable to determine path to python library."
}
fi
[ -e "$PYTHON_LIBRARY" ] || {
echo " Please set the full path to the python library "
echo " (including libpython) using the -python-lib option, "
echo " or deactivate python support by not using the -python "
echo " option"
exit 1
}
pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
pythonInclude=/usr/include/python$pythonMajor
# Note - we could also allow for a PYTHON_INCLUDE variable ...
[ -d "$pythonInclude" ] || {
echo " No python headers found in $pythonInclude/"
echo " Please install python headers or deactivate "
echo " python support by not using the -python option"
exit 1
}
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
addCMakeVariable "PYTHON_INCLUDE_PATH=$pythonInclude"
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
echo "----"
echo "Python information:"
echo " executable : $pythonBin"
echo " version : $pythonMajor"
echo " include path : $pythonInclude"
echo " library : $PYTHON_LIBRARY"
unset pythonBin pythonInclude pythonMajor
else
echo "*** Error: python not found"
echo "*** Deactivate python support by not using the -python "
echo "*** option"
exit 1
fi
}
#
# Define options for mesa support
#
addMesaSupport()
{
if [ "${withMESA:=false}" != true ]
then
return
fi
if [ -d "$MESA_INCLUDE" -a -f "$MESA_LIBRARY" ]
then
OBJ_ADD="$OBJ_ADD-mesa"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
else
echo "*** Error: no MESA information found"
echo "*** Deactivate MESA support by not using the -mesa option, "
echo "*** or set the correct paths for:"
echo "*** -mesa-include ($MESA_INCLUDE)"
echo "*** -mesa-lib ($MESA_LIBRARY)"
exit 1
fi
}
addQtSupport()
{
QtVersion=none
if [ "${withQT:=false}" != true ]
then
return
fi
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
local qmake=$(findQtMake)
# Check qmake can be found
if type $qmake >/dev/null 2>&1
then
# Check the Qt version selected
# parse -> "Using Qt version X.Y.Z in ..."
QtVersion=$($qmake -query QT_VERSION)
# Split Major.Minor.Revision - could also use IFS hacking
set -- $(echo "$QtVersion" | sed -e 's/\./ /g')
QtMajor=$1
QtMinor=$2
if [ $QtMajor -ne 4 -o $QtMajor -eq 4 -a $QtMinor -lt 5 ]
then
echo "*** Error: Qt version provided < 4.5"
echo "*** Please use the -qmake option to specify the location of a version of Qt >= 4.5 and < 5.0"
echo "*** e.g."
echo "*** -qmake /usr/local/qt-4.6.2/bin/qmake"
echo "*** -qmake $installBASE/qt-4.6.2/bin/qmake"
exit 1
fi
else
echo "*** Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
exit 1
fi
}
#
# Configure via cmake, but don't actually build anything
#
configParaView()
{
local cmake=$(findCMake)
# Remove any existing build folder and recreate
if [ -d $ParaView_BINARY_DIR ]
then
echo "removing old build directory"
echo " $ParaView_BINARY_DIR"
rm -rf $ParaView_BINARY_DIR
fi
mkdir -p $ParaView_BINARY_DIR
cd $ParaView_BINARY_DIR || exit 1 # Change to build folder
echo "----"
echo "Configuring paraview-$ParaView_VERSION (major version: $ParaView_MAJOR)"
echo " MPI support : ${withMPI:-false}"
echo " Python support : ${withPYTHON:-false}"
echo " MESA support : ${withMESA:-false}"
echo " GL2 rendering : false"
echo " Qt dev support : ${withQT:-false}"
echo " Source : $ParaView_SOURCE_DIR"
echo " Build : $ParaView_BINARY_DIR"
echo " Target : $ParaView_DIR"
echo " Cmake : $cmake"
echo "----"
echo
echo "$cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
echo
echo "----"
echo
# Run cmake to create Makefiles
$cmake -Wno-dev \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
}
#
# Invoke make
# also link bin/ to lib/paraview-* for development without installation
#
makeParaView()
{
cd $ParaView_BINARY_DIR || exit 1 # Change to build folder
echo " Starting make"
time make -j $WM_NCOMPPROCS
echo " Done make"
# Remove lib if it is a link
# (how this was previously handled before 'make install' worked)
if [ -L lib ]
then
rm lib 2>/dev/null
fi
}
#
# Install the program
#
installParaView()
{
cd $ParaView_BINARY_DIR || exit 1 # Change to build folder
echo " Installing ParaView to $ParaView_DIR"
make install
# hack for missing files after install of version 3.14.1
echo "Copying missing files to install folder"
CMAKE_SRC_DIR=$ParaView_SOURCE_DIR/CMake
CMAKE_INSTALL_DIR=$ParaView_DIR/lib/paraview-$ParaView_MAJOR/CMake
cp -f $ParaView_SOURCE_DIR/ParaViewUse.cmake $CMAKE_INSTALL_DIR
cp -f $CMAKE_SRC_DIR/generate_proxydocumentation.cmake $CMAKE_INSTALL_DIR
cp -f $CMAKE_SRC_DIR/smxml_to_xml.xsl $CMAKE_INSTALL_DIR
cp -f $CMAKE_SRC_DIR/xml_to_html.xsl $CMAKE_INSTALL_DIR
cp -f $CMAKE_SRC_DIR/xml_to_wiki.xsl.in $CMAKE_INSTALL_DIR
cp -f $CMAKE_SRC_DIR/generate_qhp.cmake $CMAKE_INSTALL_DIR
unset CMAKE_SRC_DIR CMAKE_INSTALL_DIR
# --- end hack
cat<< INFO
---
Installation complete for paraview-$ParaView_VERSION
You may need to update the OpenFOAM environment by running:
wmRefresh
---
INFO
}
#------------------------------------------------------------------------------
# Clear the referenced variables before using any of the functions
unset withMPI withVERBOSE
unset withQT QMAKE_PATH
unset withMESA MESA_INCLUDE MESA_LIBRARY
unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY
unset CMAKE_VARIABLES
unset OBJ_ADD
# Start with these general settings
addCMakeVariable "VTK_USE_TK:BOOL=OFF"
addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF"
addCMakeVariable "CMAKE_BUILD_TYPE:STRING=Release"
# Include development files in "make install"
addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON"
# Don't build test tree
addCMakeVariable "BUILD_TESTING:BOOL=OFF"
# remove dependency on WebKit
# addCMakeVariable VTK_QT_USE_WEBKIT:BOOL=OFF
#------------------------------------------------------------------------------
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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
# makeParaView3
#
# Description
# Make and install paraview for version 3.14.1 and higher
# - place the paraview source under $WM_THIRD_PARTY_DIR/ParaView-VERSION
# (note capitalisation)
#
#------------------------------------------------------------------------------
# Get ParaView_DIR location from OpenFOAM config file
. $WM_PROJECT_DIR/etc/config.sh/functions
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview)
# Determine ParaView_VERSION from ParaView_DIR location:
ParaView_VERSION="${ParaView_DIR##*/}"; export ParaView_VERSION
: ${ParaView_VERSION##*-}
#------------------------------------------------------------------------------
# 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
}
. etc/tools/ThirdPartyFunctions
. etc/tools/ParaView3Functions
#------------------------------------------------------------------------------
#
# USER OPTIONS:
# ~~~~~~~~~~~~~
# MPI support:
withMPI=false
MPI_MAX_PROCS=32
# Python support:
# note: script will try to determine the appropriate python library.
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=false
PYTHON_LIBRARY=""
# PYTHON_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libpython2.6.so.1.0"
# MESA graphics support:
withMESA=false
MESA_INCLUDE="/usr/include/GL"
MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
# extra QT gui support (useful for some third party apps)
withQT=true
# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
QMAKE_PATH=""
# Set the path to cmake
CMAKE_PATH=""
#
# NO FURTHER EDITING BELOW THIS LINE
#
#-----------------------------------------------------------------------------
Script=${0##*/}
usage() {
: ${ParaView_VERSION:=none} # some dummy value for usage information
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [OPTION] [paraview-VERSION] [CMAKE-OPTION]
options:
-rebuild for repeated builds (-make -install) *use with caution*
-mesa with mesa (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 gcc/g++ instead of the values from \$WM_CC, \$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
-mesa-include DIR location of mesa headers (current value: ${MESA_INCLUDE:-none})
-mesa-lib PATH path to mesa library (current value: ${MESA_LIBRARY:-none})
-python-lib PATH path to python library (current value: ${PYTHON_LIBRARY:-none})
-help
The -no-FEATURE option can be used to forcibly disable these features:
mesa mpi python qt
CMake options start with a capital letter and contain an '='.
For example,
$Script BUILD_TESTING=ON PARAVIEW_GENERATE_PROXY_DOCUMENTATION=OFF
to add tests and avoid building documentation
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
To make a different paraview version, simply specify on the command-line.
For example,
./makeParaview 3.14.1
Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
USAGE
exit 1
}
#------------------------------------------------------------------------------
# ensure CMake gets the correct C/C++ compiler
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
#
# add options based on script name:
#
case "$Script" in *-mesa*) withMESA=true;; esac
case "$Script" in *-mpi*) withMPI=true;; esac
case "$Script" in *-python*) withPYTHON=true;; esac
case "$Script" in *-qt*) withQT=true;; esac
# Set initial ParaView_MAJOR based on current value of ParaView_VERSION
setParaViewVersion ${ParaView_VERSION:-none}
#
# various building stages
#
unset runCONFIG runMAKE runINSTALL
runDEFAULT=true
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setParaViewVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables
addCMakeVariable "$1"
;;
-gcc)
export CC=gcc # use gcc/g++
export CXX=g++
;;
-config) # stage 1: config only
runCONFIG=true
unset runDEFAULT
;;
-no-config)
runCONFIG=false
;;
-make) # stage 2: make only
runMAKE=true
unset runDEFAULT
;;
-no-make)
runMAKE=false
;;
-install) # stage 3: install only
runINSTALL=true
unset runDEFAULT
;;
-no-install)
runINSTALL=false
;;
-rebuild) # shortcut for rebuilding
runMAKE=true
runINSTALL=true
unset runDEFAULT
;;
-mesa)
withMESA=true
;;
-no-mesa)
withMESA=false
;;