Skip to content
Snippets Groups Projects
Commit 17a443a5 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

BUG: export minimal compiler flags for VTK, ParaView (fixes #44)

- in 1906, we changed the handling of compiler flags to include the
  exact values as used by OpenFOAM.

  While this is needed for compiling some external programs -- see
  OpenFOAM-plus#1256
  for the discussion -- it appears to bring in flags that upset
  some of the ParaView (and possibly VTK) compilation.

  The culprits are likely to be found in the various '-W' switches,
  but for now we simply extract a mininal set of compiler flags
  that include -std=c++11 -m64 -fPIC, but no optimization flags,
  additional warnings flags or OpenFOAM-specific defines.
parent b987703b
No related branches found
No related tags found
No related merge requests found
...@@ -55,13 +55,51 @@ fi ...@@ -55,13 +55,51 @@ fi
unset BUILD_SUFFIX unset BUILD_SUFFIX
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Service routine to strip out OpenFOAM-specific portions from the compiler
# flags (ie, everything after "-DOPENFOAM=...") while retaining '-fPIC'
#
stripCompilerFlags()
{
local input="$@"
local flags="${input%-DOPENFOAM=*}" # Strip out OpenFOAM-specific
flags="${flags## }" # Trim leading space
flags="${flags%% }" # Trim trailing space
# Retain -fPIC though
case "$flags" in
(*-fPIC*)
# -fPIC already included
;;
(*)
case "$input" in
(*-fPIC*)
# Add -fPIC back in (was after the -DOPENFOAM=... content)
flags="$flags${flags+ }-fPIC"
;;
esac
;;
esac
echo "$flags"
}
# Export compiler settings (and flags) for CMake/configure # Export compiler settings (and flags) for CMake/configure
# based on the values from wmake -show-compile-* # based on the values from wmake -show-compile-*
# #
# Since "wmake -show-XX" is only available after 1904, continue to support # Since "wmake -show-XX" is only available after 1904, continue to support
# the previous env variables method (WM_CC, WM_CFLAGS, WM_CXX, WM_CXXFLAGS) # the previous env variables method (WM_CC, WM_CFLAGS, WM_CXX, WM_CXXFLAGS)
#
# $1 = "basic|minimal|strip" (optional)
#
# If the option 'basic' is provided, the OpenFOAM-specific portions of
# the flags are stripped out. Ie, everything after "-DOPENFOAM=..."
# but retaining '-fPIC'
#
exportCompiler() exportCompiler()
{ {
local option="$1"
local comp flag local comp flag
# C compiler and flags # C compiler and flags
...@@ -76,6 +114,11 @@ exportCompiler() ...@@ -76,6 +114,11 @@ exportCompiler()
export CC="$comp" export CC="$comp"
if [ -n "$flag" ] if [ -n "$flag" ]
then then
case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags $flag)"
;;
esac
export CFLAGS="$flag" export CFLAGS="$flag"
fi fi
fi fi
...@@ -92,11 +135,17 @@ exportCompiler() ...@@ -92,11 +135,17 @@ exportCompiler()
export CXX="$comp" export CXX="$comp"
if [ -n "$flag" ] if [ -n "$flag" ]
then then
case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags $flag)"
;;
esac
export CXXFLAGS="$flag" export CXXFLAGS="$flag"
fi fi
fi fi
} }
# Export linker settings for CMake/configure # Export linker settings for CMake/configure
exportLinker() exportLinker()
{ {
......
...@@ -127,7 +127,7 @@ USAGE ...@@ -127,7 +127,7 @@ USAGE
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages # Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL unset runPATCH runCONFIG runMAKE runINSTALL
...@@ -367,6 +367,10 @@ Features selected ...@@ -367,6 +367,10 @@ Features selected
python ${withPYTHON:-false} python ${withPYTHON:-false}
qt ${withQT:-false} qt ${withQT:-false}
--------------------- ---------------------
Compiler
cxx ${CXX:-unknown}
flags ${CXXFLAGS:-none}
---------------------
Version information Version information
paraview ${ParaView_VERSION:-unknown} paraview ${ParaView_VERSION:-unknown}
major ${ParaView_MAJOR:-unknown} major ${ParaView_MAJOR:-unknown}
......
...@@ -103,7 +103,7 @@ USAGE ...@@ -103,7 +103,7 @@ USAGE
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages # Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL unset runPATCH runCONFIG runMAKE runINSTALL
...@@ -293,6 +293,10 @@ Features selected ...@@ -293,6 +293,10 @@ Features selected
mesa ${withMESA:-false} mesa ${withMESA:-false}
mpi ${withMPI:-false} mpi ${withMPI:-false}
--------------------- ---------------------
Compiler
cxx ${CXX:-unknown}
cxxflags ${CXXFLAGS:-none}
---------------------
Version information Version information
vtk ${VTK_VERSION:-unknown} vtk ${VTK_VERSION:-unknown}
build ${BUILD_TYPE:-unknown} build ${BUILD_TYPE:-unknown}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment