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
This commit is contained in:
mark
2016-07-27 18:33:33 +02:00
parent 5de10e0e5a
commit 5dd6900492
5 changed files with 184 additions and 226 deletions

View File

@ -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" ]
local qmake=$(findQtMake)
# From somewhere other than in the path
if [ "${qmake:=qmake}" != qmake ]
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
else
echo
echo "qmake not found under specified QMAKE_PATH"
echo " QMAKE_PATH=$QMAKE_PATH"
echo "leaving unspecified"
echo
fi
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$qmake"
fi
# Fallback to qmake from the path
if [ -n "$foundExe" ]
then
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$foundExe"
else
foundExe=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