Commit 78dc8c6b authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: refactor common link rules, support FOAM_EXTRA_CFLAGS (#1256)

- additional cgal-headers-only rules (future use)

COMP: add -lgmp for CGAL with mpfr linkage
parent 595579e0
......@@ -142,10 +142,10 @@ 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]
# [FOAM_EXTRA_CFLAGS, FOAM_EXTRA_CXXFLAGS, FOAM_EXTRA_LDFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.sh> to avoid surprises.
unset FOAM_EXTRA_CXXFLAGS
unset FOAM_EXTRA_CFLAGS FOAM_EXTRA_CXXFLAGS FOAM_EXTRA_LDFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
......
......@@ -19,6 +19,10 @@
# Setup for custom compiler versions for OpenFOAM
# Per-compiler overrides in "compiler-$WM_COMPILER" files
#
# Note
# The default values for gcc/clang are not a recommendation,
# but typically correspond to the minimum usable version.
#
#------------------------------------------------------------------------------
switch ("$WM_COMPILER_TYPE")
......@@ -84,6 +88,9 @@ case ThirdParty:
case Gcc74*:
set gcc_version=gcc-7.4.0
breaksw
case Gcc75*:
set gcc_version=gcc-7.5.0
breaksw
case Gcc81*:
set gcc_version=gcc-8.1.0
breaksw
......@@ -93,12 +100,18 @@ case ThirdParty:
case Gcc83*:
set gcc_version=gcc-8.3.0
breaksw
case Gcc84*:
set gcc_version=gcc-8.4.0
breaksw
case Gcc91*:
set gcc_version=gcc-9.1.0
breaksw
case Gcc92*:
set gcc_version=gcc-9.2.0
breaksw
case Gcc93*:
set gcc_version=gcc-9.3.0
breaksw
case Clang:
set clang_version="$default_clang_version"
......
......@@ -85,8 +85,7 @@ unsetenv FOAM_CODE_TEMPLATES
unsetenv FOAM_CONFIG_ETC
unsetenv FOAM_CONFIG_MODE
unsetenv FOAM_ETC
unsetenv FOAM_EXTRA_CXXFLAGS
unsetenv FOAM_EXTRA_LDFLAGS
unsetenv FOAM_EXTRA_CFLAGS FOAM_EXTRA_CXXFLAGS FOAM_EXTRA_LDFLAGS
unsetenv FOAM_EXT_LIBBIN
unsetenv FOAM_JOB_DIR
unsetenv FOAM_LIBBIN
......
......@@ -19,6 +19,10 @@
# Setup for custom compiler versions for OpenFOAM
# Per-compiler overrides in "compiler-$WM_COMPILER" files
#
# Note
# The default values for gcc/clang are not a recommendation,
# but typically correspond to the minimum usable version.
#
#------------------------------------------------------------------------------
case "$WM_COMPILER_TYPE" in
......@@ -58,8 +62,10 @@ ThirdParty)
Gcc81*) gcc_version=gcc-8.1.0 ;;
Gcc82*) gcc_version=gcc-8.2.0 ;;
Gcc83*) gcc_version=gcc-8.3.0 ;;
Gcc84*) gcc_version=gcc-8.4.0 ;;
Gcc91*) gcc_version=gcc-9.1.0 ;;
Gcc92*) gcc_version=gcc-9.2.0 ;;
Gcc93*) gcc_version=gcc-9.3.0 ;;
Clang) clang_version="$default_clang_version" ;;
Clang37*) clang_version=llvm-3.7.1 ;;
......
......@@ -72,8 +72,7 @@ unset FOAM_CODE_TEMPLATES
unset FOAM_CONFIG_ETC
unset FOAM_CONFIG_MODE
unset FOAM_ETC
unset FOAM_EXTRA_CXXFLAGS
unset FOAM_EXTRA_LDFLAGS
unset FOAM_EXTRA_CFLAGS FOAM_EXTRA_CXXFLAGS FOAM_EXTRA_LDFLAGS
unset FOAM_EXT_LIBBIN
unset FOAM_JOB_DIR
unset FOAM_LIBBIN
......
......@@ -144,10 +144,10 @@ set projectDir=`lsof +p $$ |& sed -ne 's#^[^/]*##;\@/'"$projectName"'[^/]*/etc/c
# * on a 32-bit OS this option is ignored (always 32-bit)
#setenv WM_ARCH_OPTION 64
# [FOAM_EXTRA_CXXFLAGS]
# [FOAM_EXTRA_CFLAGS, FOAM_EXTRA_CXXFLAGS, FOAM_EXTRA_LDFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.csh> to avoid surprises.
unsetenv FOAM_EXTRA_CXXFLAGS
unsetenv FOAM_EXTRA_CFLAGS FOAM_EXTRA_CXXFLAGS FOAM_EXTRA_LDFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
......
......@@ -14,6 +14,7 @@ CGAL_LIBS = \
-L$(CGAL_ARCH_PATH)/lib \
-L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-lCGAL \
-lgmp \
-lmpfr
sinclude $(DEFAULT_RULES)/CGAL
......@@ -5,4 +5,6 @@ cc = clang
cARCH =
cDBUG =
cOPT = -O2
cWARN = -Wall
cWARN = -Wall $(FOAM_EXTRA_CFLAGS)
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared $(FOAM_EXTRA_LDFLAGS)
LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed $(FOAM_EXTRA_LDFLAGS)
......@@ -5,4 +5,6 @@ cc = gcc
cARCH =
cDBUG =
cOPT = -O2
cWARN = -Wall
cWARN = -Wall $(FOAM_EXTRA_CFLAGS)
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared -fuse-ld=gold
LINKEXE = $(CC) $(c++FLAGS) -fuse-ld=gold -L$(FOAM_LIBBIN)/dummy -lPstream
......@@ -5,4 +5,6 @@ cc = icc
cARCH =
cDBUG =
cOPT = -O2
cWARN =
cWARN = $(FOAM_EXTRA_CFLAGS)
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cFLAGS) -shared
LINKEXE = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
......@@ -5,4 +5,6 @@ cc = pgcc
cARCH =
cDBUG =
cOPT = -O2
cWARN =
cWARN = $(FOAM_EXTRA_CFLAGS)
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared $(FOAM_EXTRA_LDFLAGS)
LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed $(FOAM_EXTRA_LDFLAGS)
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