mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add canCompile test to RunFunctions
- allow conditional skipping of tutorials (for example) if wmake or the expected compiler is not available
This commit is contained in:
@ -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
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# 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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user