Commit 28e79822 authored by Mark Olesen's avatar Mark Olesen

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.
parent 7e5bdfd7
......@@ -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"
test -x $bin || {
echo "Warning: the 'wmkdep' binary is missing - attempting to build it"
( cd $src && make -s )
}
local wmDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}"
local archDir="$wmDir/platforms/$WM_ARCH$WM_COMPILER"
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
}
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 )
[ -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
......
......@@ -130,7 +130,7 @@ fi
# HYPRE_SOURCE_DIR : location of the original sources
HYPRE_SOURCE_DIR=$sourceBASE/$hyprePACKAGE
: ${HYPRE_ARCH_PATH:=$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hyprePACKAGE}
: ${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}
[ -d "$HYPRE_SOURCE_DIR" ] || {
echo "Missing sources: '$hyprePACKAGE'"
......
......@@ -130,7 +130,7 @@ fi
# METIS_SOURCE_DIR : location of the original sources
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
: ${METIS_ARCH_PATH:=$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION/$metisPACKAGE}
: ${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE}
[ -d "$METIS_SOURCE_DIR" ] || {
echo "Missing sources: '$metisPACKAGE'"
......
......@@ -96,7 +96,7 @@ fi
# MGRIDGEN_ARCH_PATH : installation directory
MGRIDGEN_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$mgridgenPACKAGE
MGRIDGEN_ARCH_PATH=$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION/$mgridgenPACKAGE
MGRIDGEN_ARCH_PATH=$installBASE$WM_SIZE_OPTIONS/$mgridgenPACKAGE
: ${FOAM_MPI:=dummy}
......
......@@ -130,7 +130,7 @@ fi
# PETSC_SOURCE_DIR : location of the original sources
PETSC_SOURCE_DIR=$sourceBASE/$petscPACKAGE
: ${PETSC_ARCH_PATH:=$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petscPACKAGE}
: ${PETSC_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$petscPACKAGE}
[ -d "$PETSC_SOURCE_DIR" ] || {
echo "Missing sources: '$petscPACKAGE'"
......@@ -141,8 +141,8 @@ PETSC_SOURCE_DIR=$sourceBASE/$petscPACKAGE
echo "Starting build: $petscPACKAGE ($targetType)"
echo
(
# PETSC arch
archOpt="${WM_PRECISION_OPTION}Int$WM_LABEL_SIZE"
# PETSC arch - same root as WM_OPTIONS (eg, DPInt32)
archOpt="$WM_SIZE_OPTIONS"
# Configuration options:
configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)"
......@@ -181,9 +181,9 @@ echo
--download-f2cblaslapack=1 \
$configOpt \
&& echo "Configured: petsc" \
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH=$archOpt all \
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH="$archOpt" all \
&& echo "Built: petsc" \
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH=$archOpt install
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH="$archOpt" install
&& echo "Installed: petsc"
) || {
echo "Error building: petsc"
......
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