- removed reliance on ParaView_INCLUDE_DIR variable for conveying the major.minor version information when compiling. This can be somewhat fragile and also adds variable that is an unnecessary when running (only used when compiling). Instead use `have_pvplugin_support` function in paraviewFunctions wmake script to determine the maj.min from the PV_PLUGIN_PATH since we have already defined the output path there with paraview maj.min numbering. Can now build with paraview from the operating system, provided that it has develop headers available. ParaView_VERSION=system In the etc/config.sh/paraview setup, the maj.min is taken from the corresponding `paraview --version` output and used when defining the PV_PLUGIN_PATH. During the build, the include path taken from `paraview-config` for a system installation, from the guess installation root of the paraview binary, or ParaView_DIR otherwise. NB: using a system ParaView for building runTimePostProcessing is unsupported. - these types of builds appear to have various library resolution issues (eg, libexpat not being loaded). Additionally, the build logic does not yet cover this type of use case.
128 lines
3.2 KiB
Bash
128 lines
3.2 KiB
Bash
#----------------------------------*-sh-*--------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM, licensed under GNU General Public License
|
|
# <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Script
|
|
# cmakeFunctions
|
|
#
|
|
# Description
|
|
# Helper functions for CMake
|
|
#------------------------------------------------------------------------------
|
|
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions # Require some wmake functions
|
|
|
|
# Ensure CMake gets the correct C/C++ compilers
|
|
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
#
|
|
# Check sentinel file(s) to handle paraview / vtk version changes
|
|
#
|
|
sameDependency()
|
|
{
|
|
local depend="$1"
|
|
local sourceDir="$2"
|
|
local objectsDir sentinel prev
|
|
|
|
# Where generated files are stored
|
|
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
|
sentinel="$objectsDir/ThirdParty"
|
|
|
|
echo "$sentinel"
|
|
|
|
if read -r prev 2>/dev/null < $sentinel
|
|
then
|
|
if [ "$prev" = "$depend" ]
|
|
then
|
|
return 0
|
|
else
|
|
echo "${depend%=*} changed between builds" 1>&2
|
|
return 1
|
|
fi
|
|
elif [ -f "$objectsDir/CMakeCache.txt" ]
|
|
then
|
|
echo "previous build was incomplete" 1>&2
|
|
return 1
|
|
else
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
|
|
# CMake with output suppressed according to WM_QUIET
|
|
_cmake()
|
|
{
|
|
echo "cmake..."
|
|
if [ -n "$WM_QUIET" ]
|
|
then
|
|
cmake -DCMAKE_RULE_MESSAGES=OFF $@ >/dev/null
|
|
else
|
|
cmake $@
|
|
fi
|
|
}
|
|
|
|
|
|
# CMake into objectsDir with external dependency
|
|
# - use sentinel file(s) to handle paraview/vtk version changes
|
|
#
|
|
# 1 - depend
|
|
# 2 - sourceDir
|
|
# 3... optional cmake defines
|
|
#
|
|
cmakeVersioned()
|
|
{
|
|
local depend="$1"
|
|
local sourceDir="$2"
|
|
shift 2
|
|
local objectsDir sentinel
|
|
|
|
# Where generated files are stored
|
|
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
|
|
|
# Version changed
|
|
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
|
rm -rf "$objectsDir" > /dev/null 2>&1
|
|
|
|
mkdir -p "$objectsDir" \
|
|
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \
|
|
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
|
}
|
|
|
|
|
|
# CMake into objectsDir with external dependency
|
|
#
|
|
# 1 - depend
|
|
# 2 - sourceDir
|
|
# 3... optional cmake defines
|
|
#
|
|
cmakeVersionedInstall()
|
|
{
|
|
local depend="$1"
|
|
local sourceDir="$2"
|
|
shift 2
|
|
local objectsDir sentinel
|
|
|
|
# Where generated files are stored
|
|
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
|
|
|
# Version changed
|
|
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
|
rm -rf "$objectsDir" > /dev/null 2>&1
|
|
|
|
mkdir -p "$objectsDir" \
|
|
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
|
|
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
|
}
|
|
|
|
|
|
#------------------------------------------------------------------------------
|