diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index 8adacd7356..0194f94624 100644 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -6,11 +6,10 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2015-2018 OpenCFD Ltd. +# Copyright (C) 2015-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License -# This file is part of OpenFOAM, licensed under GNU General Public License -# . +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # Script # RunFunctions @@ -54,6 +53,33 @@ notTest() return 0 } +# +# Test for wmake and compiler suite or emit warning +# +canCompile() +{ + if ! command -v wmake >/dev/null + then + echo "No wmake command found ... cannot compile" 1>&2 + return 1 + fi + + local cxx_compiler + cxx_compiler="$(wmake -show-cxx 2>/dev/null)" + + if [ -z "$cxx_compiler" ] + then + echo "No wmake rule for C++ compiler? ... cannot compile" 1>&2 + return 1 + elif ! command -v "$cxx_compiler" >/dev/null + then + echo "No path to C++ compiler ($cxx_compiler) ... cannot compile" 1>&2 + return 1 + fi + + return 0 +} + # # Check if '$1' corresponds to an OpenFOAM value for 'true' (see Switch.H) diff --git a/tutorials/incompressible/pimpleFoam/laminar/contaminatedDroplet2D/Allrun b/tutorials/incompressible/pimpleFoam/laminar/contaminatedDroplet2D/Allrun index cedcdfc372..7f733484c4 100755 --- a/tutorials/incompressible/pimpleFoam/laminar/contaminatedDroplet2D/Allrun +++ b/tutorials/incompressible/pimpleFoam/laminar/contaminatedDroplet2D/Allrun @@ -3,6 +3,12 @@ cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ +if ! canCompile +then + echo "skipping tutorial $PWD" + exit 0 +fi + m4 < ./system/blockMeshDict.m4 > ./system/blockMeshDict runApplication blockMesh diff --git a/tutorials/incompressible/pimpleFoam/laminar/planarPoiseuille/Allrun b/tutorials/incompressible/pimpleFoam/laminar/planarPoiseuille/Allrun index c806150738..dce2c86164 100755 --- a/tutorials/incompressible/pimpleFoam/laminar/planarPoiseuille/Allrun +++ b/tutorials/incompressible/pimpleFoam/laminar/planarPoiseuille/Allrun @@ -15,6 +15,12 @@ then endTime=25 fi +if ! canCompile +then + echo "skipping tutorial $PWD" + exit 0 +fi + #------------------------------------------------------------------------------ # Compute the case in 'serial' mode, and collect the data diff --git a/tutorials/incompressible/pimpleFoam/laminar/sloshing2D/Allrun b/tutorials/incompressible/pimpleFoam/laminar/sloshing2D/Allrun index fdd5a79e9e..8376cad567 100755 --- a/tutorials/incompressible/pimpleFoam/laminar/sloshing2D/Allrun +++ b/tutorials/incompressible/pimpleFoam/laminar/sloshing2D/Allrun @@ -3,6 +3,12 @@ cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ +if ! canCompile +then + echo "skipping tutorial $PWD" + exit 0 +fi + runApplication blockMesh runApplication makeFaMesh diff --git a/tutorials/mesh/refineMesh/refineFieldDirs/Allrun b/tutorials/mesh/refineMesh/refineFieldDirs/Allrun index cc76457010..7909fb899c 100755 --- a/tutorials/mesh/refineMesh/refineFieldDirs/Allrun +++ b/tutorials/mesh/refineMesh/refineFieldDirs/Allrun @@ -3,6 +3,12 @@ cd "${0%/*}" || exit # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ +if ! canCompile +then + echo "skipping tutorial $PWD" + exit 0 +fi + wmake calcRadiusField wclean calcRadiusField