Commit f49d26da authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: more stringent checks for WM compiler settings (issue #29)

- only export the WM_* settings to their plain counterparts

     (eg, export CC=$WM_CC)

  when they actually point to an accessible program

  This helps in particular when bootstrapping builds with third-party
  compilers.
parent 4c049afb
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -32,13 +32,8 @@ cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
# Compiler/linker settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
exportCompiler true # Compiler info + flags for CMake/configure
exportLinker # Linker flags for CMake/configure
useGccFlag $@ # Scan arguments for a '-gcc' option
warnBuildIssues()
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -26,6 +26,35 @@ installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
unset BUILD_SUFFIX
#------------------------------------------------------------------------------
# Export WM compiler settings (and flags) for CMake/configure
# $1 = true: export compiler flags too
exportCompiler()
{
if test -n "$WM_CC" && command -v "$WM_CC" >/dev/null
then
export CC="$WM_CC"
if [ "$1" = true -a -n "$WM_CFLAGS" ]
then
export CFLAGS="$WM_CFLAGS"
fi
fi
if test -n "$WM_CXX" && command -v "$WM_CXX" >/dev/null
then
export CXX="$WM_CXX"
if [ "$1" = true -a -n "$WM_CXXFLAGS" ]
then
export CXXFLAGS="$WM_CXXFLAGS"
fi
fi
}
# Export WM linker settings for CMake/configure
exportLinker()
{
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
}
# Force use of gcc/g++
useGcc()
{
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -52,11 +52,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
exportCompiler true # Compiler info + flags for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -104,12 +104,9 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
unset optHeadersOnly
# Parse options
while [ "$#" -gt 0 ]
do
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -53,9 +53,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
unset optLink
# Parse options
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -66,9 +66,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -51,9 +51,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -72,10 +72,8 @@ options:
USAGE
exit 1
}
#-----------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -81,9 +81,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -53,9 +53,7 @@ USAGE
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -77,9 +77,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -59,9 +59,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Non-standard location for clang?
case "$WM_COMPILER_TYPE-$WM_COMPILER" in
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -80,9 +80,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
unset optMemchecker optThreaded
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -111,9 +111,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -44,11 +44,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler/linker settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
exportCompiler true # Compiler info + flags for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -61,9 +61,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -95,9 +95,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
exportCompiler # Compiler info for CMake/configure
# Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL
......
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