Commit 5dd69004 authored by mark's avatar mark
Browse files

ENH: relocate common functions into ThirdPartyFunctions

- Qualify some paraview-specific functions with 'ParaView' in the name.
  This helps with code-reuse.

STYLE: use lib$WM_COMPILER_LIB_ARCH instead of explicit lib64
parent 5de10e0e
......@@ -39,7 +39,7 @@
# ParaView_BINARY_DIR : location of the build
# ParaView_DIR : location of the installed program
#
setDirs()
setParaViewDirs()
{
ParaView_SOURCE_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
......@@ -74,10 +74,10 @@ setDirs()
#
# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0
#
setVersion()
setParaViewVersion()
{
[ $# -gt 0 ] || {
echo "Error: function setVersion() called without an argument"
echo "Error: function setParaViewVersion() called without an argument"
exit 1
}
......@@ -241,7 +241,7 @@ addMesaSupport()
then
OBJ_ADD="$OBJ_ADD-mesa"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
......@@ -267,54 +267,14 @@ addQtSupport()
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
unset qmakeExe
if [ -n "$QMAKE_PATH" ]
then
if [ -d "$QMAKE_PATH" ]
then
if [ -x "$QMAKE_PATH/qmake" ]
then
qmakeExe=$QMAKE_PATH/qmake
elif [ -x "$QMAKE_PATH/bin/qmake" ]
then
qmakeExe=$QMAKE_PATH/bin/qmake
fi
elif [ -x "$QMAKE_PATH" ]
then
qmakeExe=$QMAKE_PATH
fi
if [ -n "$qmakeExe" ]
then
# Use absolute path
if [ "${qmakeExe#/}" = "$qmakeExe" ]
then
qmakeExe="$(cd ${qmakeExe%/qmake} 2>/dev/null && pwd)/qmake"
fi
else
echo
echo "qmake not found under specified QMAKE_PATH"
echo " QMAKE_PATH=$QMAKE_PATH"
echo "leaving unspecified"
echo
fi
fi
# Default to using qmake from the path
if [ -n "$qmakeExe" ]
then
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$qmakeExe"
else
qmakeExe=qmake
fi
local qmake=$(findQtMake)
# Check qmake can be found
if type $qmakeExe >/dev/null 2>&1
if type $qmake >/dev/null 2>&1
then
# Check the Qt version selected
# parse -> "Using Qt version X.Y.Z in ..."
QtVersion=$($qmakeExe -query QT_VERSION)
QtVersion=$($qmake -query QT_VERSION)
# Split Major.Minor.Revision - could also use IFS hacking
set -- $(echo "$QtVersion" | sed -e 's/\./ /g')
......@@ -343,44 +303,7 @@ addQtSupport()
#
configParaView()
{
unset cmakeExe
if [ -n "$CMAKE_PATH" ]
then
if [ -d "$CMAKE_PATH" ]
then
if [ -x "$CMAKE_PATH/cmake" ]
then
cmakeExe=$CMAKE_PATH/cmake
elif [ -x "$CMAKE_PATH/bin/cmake" ]
then
cmakeExe=$CMAKE_PATH/bin/cmake
fi
elif [ -x "$CMAKE_PATH" ]
then
cmakeExe=$CMAKE_PATH
fi
if [ -n "$cmakeExe" ]
then
# Use absolute path
if [ "${cmakeExe#/}" = "$cmakeExe" ]
then
cmakeExe="$(cd ${cmakeExe%/cmake} 2>/dev/null && pwd)/cmake"
fi
else
echo
echo "cmake not found under specified CMAKE_PATH"
echo " CMAKE_PATH=$CMAKE_PATH"
echo "leaving unspecified"
echo
fi
fi
# Default to using cmake from the path
if [ -z "$cmakeExe" ]
then
cmakeExe=cmake
fi
local cmake=$(findCMake)
# Remove any existing build folder and recreate
if [ -d $ParaView_BINARY_DIR ]
......@@ -403,9 +326,10 @@ configParaView()
echo " Source : $ParaView_SOURCE_DIR"
echo " Build : $ParaView_BINARY_DIR"
echo " Target : $ParaView_DIR"
echo " Cmake : $cmake"
echo "----"
echo
echo "$cmakeExe" \
echo "$cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
......@@ -414,7 +338,7 @@ configParaView()
echo
# Run cmake to create Makefiles
$cmakeExe -Wno-dev \
$cmake -Wno-dev \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
......
......@@ -39,7 +39,7 @@
# ParaView_BINARY_DIR : location of the build
# ParaView_DIR : location of the installed program
#
setDirs()
setParaViewDirs()
{
ParaView_SOURCE_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
......@@ -74,10 +74,10 @@ setDirs()
#
# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0
#
setVersion()
setParaViewVersion()
{
[ $# -gt 0 ] || {
echo "Error: function setVersion() called without an argument"
echo "Error: function setParaViewVersion() called without an argument"
exit 1
}
......@@ -241,7 +241,7 @@ addMesaSupport()
then
OBJ_ADD="$OBJ_ADD-mesa"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
......@@ -279,74 +279,20 @@ addQtSupport()
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
local candidate
local foundExe
if [ -n "$QMAKE_PATH" ]
then
# check as directory
if [ -d "$QMAKE_PATH" ]
then
for candidate in \
$QMAKE_PATH/qmake \
$QMAKE_PATH/bin/qmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
# check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
$QMAKE_PATH \
$installBASE/$QMAKE_PATH/bin/qmake \
$installBASE/qt-$QMAKE_PATH/bin/qmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
local qmake=$(findQtMake)
if [ -n "$foundExe" ]
then
# Use absolute path
if [ "${foundExe#/}" = "$foundExe" ]
then
foundExe="$(cd ${foundExe%/qmake} 2>/dev/null && pwd)/qmake"
fi
else
echo
echo "qmake not found under specified QMAKE_PATH"
echo " QMAKE_PATH=$QMAKE_PATH"
echo "leaving unspecified"
echo
fi
fi
# Fallback to qmake from the path
if [ -n "$foundExe" ]
# From somewhere other than in the path
if [ "${qmake:=qmake}" != qmake ]
then
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$foundExe"
else
foundExe=qmake
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$qmake"
fi
# Check qmake can be found
if type $foundExe >/dev/null 2>&1
if type $qmake >/dev/null 2>&1
then
# Check the Qt version selected
# parse -> "Using Qt version X.Y.Z in ..."
QtVersion=$($foundExe -query QT_VERSION)
QtVersion=$($qmake -query QT_VERSION)
# Split Major.Minor.Revision - could also use IFS hacking
set -- $(echo "$QtVersion" | sed -e 's/\./ /g')
......@@ -384,61 +330,7 @@ patchParaView()
#
configParaView()
{
local candidate
local foundExe
if [ -n "$CMAKE_PATH" ]
then
# check as directory
if [ -d "$CMAKE_PATH" ]
then
for candidate in \
$CMAKE_PATH/cmake \
$CMAKE_PATH/bin/cmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
# check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
$CMAKE_PATH \
$installBASE/$CMAKE_PATH/bin/cmake \
$installBASE/cmake-$CMAKE_PATH/bin/cmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
if [ -n "$foundExe" ]
then
# Use absolute path
if [ "${foundExe#/}" = "$foundExe" ]
then
foundExe="$(cd ${foundExe%/cmake} 2>/dev/null && pwd)/cmake"
fi
else
echo
echo "cmake not found under specified CMAKE_PATH"
echo " CMAKE_PATH=$CMAKE_PATH"
echo "leaving unspecified"
echo
fi
fi
# Fallback to cmake from the path
[ -n "$foundExe" ] || foundExe=cmake
local cmake=$(findCMake)
# Remove any existing build folder and recreate
if [ -d $ParaView_BINARY_DIR ]
......@@ -464,10 +356,10 @@ configParaView()
echo " Build : $ParaView_BINARY_DIR"
echo " Target : $ParaView_DIR"
echo " Build type : $buildType"
echo " Cmake : $foundExe"
echo " Cmake : $cmake"
echo "----"
echo
echo "$foundExe" \
echo "$cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
......@@ -476,7 +368,7 @@ configParaView()
echo
# Run cmake to create Makefiles
$foundExe \
$cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
......
......@@ -85,6 +85,142 @@ _foamIsSystem()
}
#
# try to locate cmake according to the CMAKE_PATH
# or just use what is found in the path
#
findCMake()
{
local candidate
local foundExe
if [ -n "$CMAKE_PATH" ]
then
# check as directory
if [ -d "$CMAKE_PATH" ]
then
for candidate in \
$CMAKE_PATH/cmake \
$CMAKE_PATH/bin/cmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
# check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
$CMAKE_PATH \
$installBASE/$CMAKE_PATH/bin/cmake \
$installBASE/cmake-$CMAKE_PATH/bin/cmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
if [ -n "$foundExe" ]
then
# Use absolute path
if [ "${foundExe#/}" = "$foundExe" ]
then
foundExe="$(cd ${foundExe%/cmake} 2>/dev/null && pwd)/cmake"
fi
echo "$foundExe"
return 0
else
cat << NOT_FOUND 1>&2
'cmake' not found under specified CMAKE_PATH
CMAKE_PATH=$CMAKE_PATH
reverting to using command from path
NOT_FOUND
fi
fi
# Default is cmake from the path
echo cmake
}
#
# try to locate qmake according to the QMAKE_PATH
# or just use what is found in the path
#
findQtMake()
{
local candidate
local foundExe
if [ -n "$QMAKE_PATH" ]
then
# check as directory
if [ -d "$QMAKE_PATH" ]
then
for candidate in \
$QMAKE_PATH/qmake \
$QMAKE_PATH/bin/qmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
# check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
$QMAKE_PATH \
$installBASE/$QMAKE_PATH/bin/qmake \
$installBASE/qt-$QMAKE_PATH/bin/qmake \
;
do
if [ -f "$candidate" -a -x "$candidate" ]
then
foundExe=$candidate
break
fi
done
fi
if [ -n "$foundExe" ]
then
# Use absolute path
if [ "${foundExe#/}" = "$foundExe" ]
then
foundExe="$(cd ${foundExe%/qmake} 2>/dev/null && pwd)/qmake"
fi
echo "$foundExe"
return 0
else
cat << NOT_FOUND 1>&2
'qmake' not found under specified QMAKE_PATH
QMAKE_PATH=$QMAKE_PATH
reverting to using command from path
NOT_FOUND
fi
fi
# Default is qmake from the path
echo qmake
}
#
# Download file $1 from url $2 into download/ directory
#
......
......@@ -64,12 +64,12 @@ MPI_MAX_PROCS=32
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=false
PYTHON_LIBRARY=""
# PYTHON_LIBRARY="/usr/lib64/libpython2.6.so.1.0"
# 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/lib64/libOSMesa.so"
MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
# extra QT gui support (useful for some third party apps)
withQT=true
......@@ -113,8 +113,8 @@ options:
-version VER specify an alternative version (current value: $ParaView_VERSION)
-major VER specify an alternative major version for special builds
-buildType NAME specify the build type (default: Release)
-mesa-include DIR
location of mesa headers (current value: ${MESA_INCLUDE:-none})
-mesa-prefix DIR location of mesa installation (sets -mesa-include, -mesa-lib)
-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
......@@ -164,7 +164,7 @@ 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
setVersion ${ParaView_VERSION:-none}
setParaViewVersion ${ParaView_VERSION:-none}
#
# various building stages
......@@ -181,7 +181,7 @@ do
usage
;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setVersion "${1%%/}"
setParaViewVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables
addCMakeVariable "$1"
......@@ -235,6 +235,13 @@ do
-no-mesa)
withMESA=false
;;
-mesa-prefix)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMESA=true
MESA_INCLUDE="${2%%/}/include"
MESA_LIBRARY="${2%%/}/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
shift
;;
-mesa-include)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
MESA_INCLUDE="${2%%/}"
......@@ -286,7 +293,7 @@ do
;;
-version)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
setVersion "${2%%/}"
setParaViewVersion "${2%%/}"
shift
;;
-major)
......@@ -344,7 +351,7 @@ addMesaSupport # set MESA-specific options
addGL2Support # new rendering backend
addQtSupport # add extra Qt support
setDirs # where things are or should be put
setParaViewDirs # where things are or should be put
# Build and install
......
......@@ -64,12 +64,12 @@ MPI_MAX_PROCS=32
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=false
PYTHON_LIBRARY=""
# PYTHON_LIBRARY="/usr/lib64/libpython2.6.so.1.0"
# 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/lib64/libOSMesa.so"
MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
# extra QT gui support (useful for some third party apps)
withQT=true
......@@ -107,8 +107,7 @@ options:
-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-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
......@@ -157,7 +156,7 @@ 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
setVersion ${ParaView_VERSION:-none}
setParaViewVersion ${ParaView_VERSION:-none}
#
# various building stages
......@@ -173,7 +172,7 @@ do
usage
;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setVersion "${1%%/}"
setParaViewVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables
addCMakeVariable "$1"
......@@ -265,7 +264,7 @@ do
;;
-version)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
setVersion "${2%%/}"
setParaViewVersion "${2%%/}"
shift
;;
-major)
......@@ -305,7 +304,7 @@ addPythonSupport # set Python-specific options
addMesaSupport # set MESA-specific options
addQtSupport # add extra Qt support
setDirs # where things are or should be put
setParaViewDirs # where things are or should be put
# Build and install
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment