From 2f07de03ff33384dc11367a7d73826fe8454f72d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Dec 2021 11:41:13 +0100 Subject: [PATCH] COMP: add -pthread for AMD compiler rule - https://github.com/spack/spack/pull/27949 COMP: respect FOAM_BUILDROOT for wmake -queue STYLE: fix stray paraview setting --- Allwmake | 11 ++++++----- etc/config.csh/paraview | 2 +- modules/Allwmake | 7 ++++--- modules/list-modules | 3 ++- wmake/rules/linux64Amd/c++ | 2 +- wmake/wmake | 28 +++++++++++++++++++++++----- 6 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Allwmake b/Allwmake index 87f8371ff6..27f04e6d2e 100755 --- a/Allwmake +++ b/Allwmake @@ -70,15 +70,16 @@ applications/Allwmake $targetType $* # Additional components/modules -if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ] -then +case "$FOAM_MODULE_PREFIX" in +(false | none) echo ======================================== echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})" echo -else + ;; +(*) # Use wmake -all instead of Allwmake to allow for overrides - (cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all) -fi + ( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all ) +esac # Count files in given directory. Ignore "Test-*" binaries. _foamCountDirEntries() diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index 0b17a9e75b..014d5b4638 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -169,7 +169,7 @@ default: endsw foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib") if ( -d "${qtDir}/${libDir}" ) then - set pv_libdirs="${qtDir}/${libDir}:${pv_libdirs}" + set pv_libdirs="${qtDir}/${libDir}" break endif end diff --git a/modules/Allwmake b/modules/Allwmake index a5a481bffd..c5e3b2c4f4 100755 --- a/modules/Allwmake +++ b/modules/Allwmake @@ -12,12 +12,12 @@ targetType=libso export FOAM_MODULE_PREFIX echo "========================================" -if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ] -then +case "$FOAM_MODULE_PREFIX" in +(false | none) echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})" echo exit 0 -fi +esac echo "prefix = $FOAM_MODULE_PREFIX" echo @@ -33,6 +33,7 @@ for moduleName in $(./list-modules) do if [ -d "$moduleName" ] then + # Use wmake -all instead of Allwmake to allow for overrides ( cd "$moduleName" && wmake -all $targetType ) fi done diff --git a/modules/list-modules b/modules/list-modules index c41c57d466..c87750b97f 100755 --- a/modules/list-modules +++ b/modules/list-modules @@ -6,9 +6,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# SPDX-License-Identifier: (GPL-3.0+) # Copyright (C) 2020 OpenCFD Ltd. #------------------------------------------------------------------------------ +# SPDX-License-Identifier: (GPL-3.0+) +# # Script # list-modules # diff --git a/wmake/rules/linux64Amd/c++ b/wmake/rules/linux64Amd/c++ index 9840e7548f..110baa9ecd 100644 --- a/wmake/rules/linux64Amd/c++ +++ b/wmake/rules/linux64Amd/c++ @@ -2,7 +2,7 @@ # AMD compiler - a clang variant include $(GENERAL_RULES)/Clang/c++ -c++ARCH = -m64 +c++ARCH = -m64 -pthread include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) diff --git a/wmake/wmake b/wmake/wmake index 9d144d1bc9..349fa96772 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -59,8 +59,8 @@ Usage: $Script [OPTION] [dir] options: -s | -silent Silent mode (do not echo commands) - -a | -all wmake all sub-directories, running Allwmake if present - -q | -queue wmakeCollect sub-directories, running Allwmake if present + -a | -all wmake all sub-directories, runs Allwmake if present + -q | -queue Collect as single Makefile, runs Allwmake if present -k | -keep-going Keep going even when errors occur (-non-stop) -j | -jN | -j N Compile using all or specified N cores/hyperthreads -update Update lnInclude, dep files, remove deprecated files/dirs @@ -559,13 +559,31 @@ if [ "$optAll" = queue ] then [ "$optUpdate" = true ] || wmakeLnIncludeAll $parOpt + if [ -n "$FOAM_BUILDROOT" ] && [ -w "$FOAM_BUILDROOT" ] + then + buildRoot="${FOAM_BUILDROOT}/build/${WM_OPTIONS}" + else + # Assumed to be writable + buildRoot="${WM_PROJECT_DIR}/build/${WM_OPTIONS}" + fi + + # Use relative dirname if possible (reproducible names) + if [ "${PWD}" = "${WM_PROJECT_DIR}" ] + then + collectName="_project_" + else + collectName="_${PWD#${WM_PROJECT_DIR}/}" + collectName="${collectName////_}" # Path as unique name + fi + + ## echo "collect: $buildRoot/$collectName" 1>&2 ( - export WM_COLLECT_DIR="$WM_PROJECT_DIR/build/${WM_OPTIONS}/${PWD////_}" + export WM_COLLECT_DIR="$buildRoot/$collectName" export WM_SCHEDULER="$WM_DIR/wmakeCollect" trap '$WM_SCHEDULER -kill' TERM INT "$WM_SCHEDULER" -clean \ - && wmake -all objects \ - && "$WM_SCHEDULER" + && wmake -all objects \ + && "$WM_SCHEDULER" # Make with assembled makefile ) && wmake -all exit $? fi