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

CONFIG: support FOAM_EXTRA_CXXFLAGS (#1256)

- allows custom tuning of compilation parameters
parent ba3a31af
......@@ -136,6 +136,11 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# * on a 32-bit OS this option is ignored (always 32-bit)
#export WM_ARCH_OPTION=64
# [FOAM_EXTRA_CXXFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.sh> to avoid surprises.
unset FOAM_EXTRA_CXXFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
......
......@@ -9,8 +9,7 @@
# Copyright (C) 2016-2019 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.
#
# File
# etc/config.csh/unset
......@@ -46,20 +45,15 @@ endif
unsetenv WM_ARCH
unsetenv WM_ARCH_OPTION
unsetenv WM_CC
unsetenv WM_CFLAGS
unsetenv WM_COMPILER
unsetenv WM_COMPILER_ARCH
unsetenv WM_COMPILER_TYPE
unsetenv WM_COMPILER_LIB_ARCH
unsetenv WM_COMPILE_OPTION
unsetenv WM_CXX
unsetenv WM_CXXFLAGS
unsetenv WM_DIR
unsetenv WM_HOSTS
unsetenv WM_LABEL_OPTION
unsetenv WM_LABEL_SIZE
unsetenv WM_LDFLAGS
unsetenv WM_MPLIB
unsetenv WM_NCOMPPROCS
unsetenv WM_OPTIONS
......@@ -75,6 +69,11 @@ unsetenv WM_PROJECT_VERSION
unsetenv WM_SCHEDULER
unsetenv WM_THIRD_PARTY_DIR
# Older variables
# Before 1906
unsetenv WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
......@@ -84,8 +83,9 @@ unsetenv FOAM_APPBIN
unsetenv FOAM_APP
unsetenv FOAM_CODE_TEMPLATES
unsetenv FOAM_ETC
unsetenv FOAM_EXTRA_CXXFLAGS
unsetenv FOAM_EXTRA_LDFLAGS
unsetenv FOAM_EXT_LIBBIN
unsetenv FOAM_INST_DIR
unsetenv FOAM_JOB_DIR
unsetenv FOAM_LIBBIN
unsetenv FOAM_MPI
......@@ -102,6 +102,10 @@ unsetenv FOAM_USER_APPBIN
unsetenv FOAM_USER_LIBBIN
unsetenv FOAM_UTILITIES
# Old variables
# Before 1812
unsetenv FOAM_INST_DIR
#------------------------------------------------------------------------------
# Unset MPI-related environment variables
......
......@@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-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.
#
# File
# etc/config.sh/unset
......@@ -35,19 +34,14 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
unset WM_ARCH
unset WM_ARCH_OPTION
unset WM_CC
unset WM_CFLAGS
unset WM_COMPILER
unset WM_COMPILER_TYPE
unset WM_COMPILER_LIB_ARCH
unset WM_COMPILE_OPTION
unset WM_CXX
unset WM_CXXFLAGS
unset WM_DIR
unset WM_HOSTS
unset WM_LABEL_OPTION
unset WM_LABEL_SIZE
unset WM_LDFLAGS
unset WM_MPLIB
unset WM_NCOMPPROCS
unset WM_OPTIONS
......@@ -63,6 +57,10 @@ unset WM_PROJECT_VERSION
unset WM_SCHEDULER
unset WM_THIRD_PARTY_DIR
# Older variables
# Before 1906
unset WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
......@@ -72,8 +70,9 @@ unset FOAM_APPBIN
unset FOAM_APP
unset FOAM_CODE_TEMPLATES
unset FOAM_ETC
unset FOAM_EXTRA_CXXFLAGS
unset FOAM_EXTRA_LDFLAGS
unset FOAM_EXT_LIBBIN
unset FOAM_INST_DIR
unset FOAM_JOB_DIR
unset FOAM_LIBBIN
unset FOAM_MPI
......@@ -90,6 +89,10 @@ unset FOAM_USER_APPBIN
unset FOAM_USER_LIBBIN
unset FOAM_UTILITIES
# Old variables
# Before 1812
unset FOAM_INST_DIR
#------------------------------------------------------------------------------
# Unset MPI-related environment variables
......
......@@ -138,6 +138,11 @@ set projectDir=`lsof +p $$ |& \
# * on a 32-bit OS this option is ignored (always 32-bit)
#setenv WM_ARCH_OPTION 64
# [FOAM_EXTRA_CXXFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.csh> to avoid surprises.
unsetenv FOAM_EXTRA_CXXFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
......
......@@ -14,9 +14,12 @@ c++WARN = \
-Wall -Wextra -Wold-style-cast \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-undefined-var-template \
-Wno-unknown-warning-option
-Wno-unknown-warning-option \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-Wno-old-style-cast -Wno-unused-local-typedefs \
-Wno-tautological-undefined-compare -Wno-shift-negative-value \
-Wno-null-pointer-arithmetic
#------------------------------------------------------------------------------
......@@ -13,9 +13,12 @@ ptFLAGS = -DNoRepository -ftemplate-depth-100
c++WARN = \
-Wall -Wextra -Wold-style-cast \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-attributes -Wno-unknown-pragmas
-Wno-attributes -Wno-unknown-pragmas \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds \
-Wno-deprecated-declarations \
-fpermissive
#------------------------------------------------------------------------------
......@@ -14,7 +14,10 @@ c++WARN = \
-Wall -Wextra \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-unknown-pragmas \
-diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076
-diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-diag-disable 1224,2026,2305
#------------------------------------------------------------------------------
......@@ -10,5 +10,9 @@ ptFLAGS = -DNoRepository
# - Standard warnings
# - Less restrictive warnings (may be needed for flex++, CGAL, etc.)
c++WARN =
c++WARN = \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN =
#------------------------------------------------------------------------------
......@@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -37,37 +37,52 @@
# lnInclude directories generated for libraries.
#
#------------------------------------------------------------------------------
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions
. "${0%/*}/scripts/wmakeFunctions" # Source wmake functions
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
printHelp() {
cat<<HELP_INFO
Usage: $Script [OPTION] [dir]
$Script [OPTION] target [dir [MakeDir]]
options:
-a | -all Same as the 'all' target
-a | -all All subdirectories, uses Allwclean, Allclean if they exist
-s | -silent Ignored - for compatibility with wmake
-help Print the usage
-h | -help Display short help and exit
-help-full Display full help and exit
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
lnInclude directories generated for libraries.
The targets correspond to a subset of the 'wmake' special targets:
all All subdirectories, uses any Allwclean or Allclean
files if they exist
HELP_INFO
cat<<HELP_TAIL_FULL
Special targets:
all Same as -all option
exe | lib | libo | libso
Clean Make, any *.dep files and lnInclude directories
empty Remove empty sub-directories for the requested dir.
If executed in the main project directory, it will also
remove deprecated object directories and respective binaries
that refer to no-longer-existing source code.
USAGE
HELP_TAIL_FULL
exit 0 # clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
# Parse arguments and options
#------------------------------------------------------------------------------
......@@ -78,16 +93,20 @@ MakeDir=Make
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
usage
-help-f*) # Full help
printHelp -full
;;
-h | -help*) # Short help
printHelp
;;
-a | -all | all)
targetType=all
;;
-s | -silent) # Ignored - for compatibility with wmake
export WM_QUIET=true
;;
-*)
usage "unknown option: '$1'"
die "unknown option: '$1'"
;;
*)
break
......
......@@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2019 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -94,19 +94,22 @@ cat<<HELP_FULL
HELP_FULL
fi
cat<<HELP_TAIL
cat<<HELP_TAIL_COMMON
-pwd Print root directory containing a Make/ directory
-version | --version Print version, which is the same as -show-api
-version | --version Print version (same as -show-api)
-h | -help Display short help and exit
-help-full Display full help and exit
A general, easy-to-use make system for multi-platform development
with support for local and network parallel compilation.
The 'target' is a Makefile target:
e.g., platforms/linux64GccDPOpt/.../fvMesh.o
HELP_TAIL_COMMON
or a special target:
if [ -n "$1" ]
then
cat<<HELP_TAIL_FULL
Makefile targets: platforms/linux64GccDPInt32Opt/.../fvMesh.o (for example)
Special targets:
all | queue Same as -all | -queue options
exe Compile statically linked executable
lib Compile statically linked archive lib (.a)
......@@ -116,10 +119,23 @@ or a special target:
updatedep Compile dependencies only (in case of broken dependencies)
objects Compile but not link
HELP_TAIL
exit 1
Environment
FOAM_EXTRA_CXXFLAGS
HELP_TAIL_FULL
else
cat<<HELP_TAIL_BRIEF
Some special targets (see -help-full for details):
all | queue Same as -all | -queue options
exe Executables
lib libo libso Libraries
HELP_TAIL_BRIEF
fi
exit 0 # clean exit
}
# Report error and exit
die()
{
......
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