ENH: minor build script improvements

- add internal WM_SIZE_OPTIONS variable for reduced typing
- check for wmkdepend and wmkdep for wmake builds
- avoid egrep for getting processor count.
This commit is contained in:
Mark Olesen
2018-12-03 08:14:54 +01:00
parent 7e5bdfd747
commit 28e7982258
5 changed files with 35 additions and 31 deletions

View File

@ -20,9 +20,12 @@
#------------------------------------------------------------------------------
# The normal locations for source, build and installation (prefix-dir)
sourceBASE=$WM_THIRD_PARTY_DIR
buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER
installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
sourceBASE="$WM_THIRD_PARTY_DIR"
buildBASE="$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER"
installBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
# Synthetic value combining precision and label size (Eg, DPInt32)
WM_SIZE_OPTIONS="${WM_PRECISION_OPTION}Int${WM_LABEL_SIZE}"
# Dynamic library endings (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so
@ -116,29 +119,32 @@ whichMpicxx()
echo "${mpicxx:-mpicxx}"
}
# The presence of wmkdep etc required for building with wmake
# Require wmkdepend etc when building with wmake
requireWMakeToolchain()
{
local dir="${WM_DIR:-$WM_PROJECT_DIR/wmake}"
local src="$dir/src"
local bin="$dir/platforms/$WM_ARCH$WM_COMPILER/wmkdep"
local wmDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}"
local archDir="$wmDir/platforms/$WM_ARCH$WM_COMPILER"
test -x $bin || {
echo "Warning: the 'wmkdep' binary is missing - attempting to build it"
( cd $src && make -s )
}
if [ -x "$archDir/wmkdepend" ] || [ -x "$archDir/wmkdep" ]
then
echo "Appear to have {wmkdepend,wmkdep} binary" 1>&2
else
echo "Warning: appear to be missing {wmkdepend,wmkdep} binary ... building" 1>&2
( cd "$wmDir/src" && make -s )
test -x $bin || {
exec 1>&2
echo
echo "Error: cannot use wmake build for '${0##*/}"
echo " The 'wmkdep' binary is missing"
echo " Please run the top-level OpenFOAM Allwmake first"
echo
exit 1
}
[ -x "$archDir/wmkdepend" ] || [ -x "$archDir/wmkdep" ] || {
exec 1>&2
echo
echo "Error: cannot use wmake build for '${0##*/}"
echo " Missing {wmkdepend,wmkdep} binary"
echo " Please try run the top-level OpenFOAM Allwmake first"
echo
exit 1
}
fi
}
#------------------------------------------------------------------------------
# Some functions as per OpenFOAM etc/config.sh/functions
@ -189,9 +195,7 @@ setBuildSuffix()
#
unset WM_HOSTS WM_SCHEDULER
WM_NCOMPPROCS=$(egrep -c "^processor" /proc/cpuinfo 2>/dev/null) || \
WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || \
WM_NCOMPPROCS=1
WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || WM_NCOMPPROCS=1
: ${WM_NCOMPPROCS:=1}
export WM_NCOMPPROCS