Commit 17a443a5 authored by Mark Olesen's avatar Mark Olesen

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
......@@ -55,13 +55,51 @@ fi
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
# based on the values from wmake -show-compile-*
#
# 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)
#
# $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()
{
local option="$1"
local comp flag
# C compiler and flags
......@@ -76,6 +114,11 @@ exportCompiler()
export CC="$comp"
if [ -n "$flag" ]
then
case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags $flag)"
;;
esac
export CFLAGS="$flag"
fi
fi
......@@ -92,11 +135,17 @@ exportCompiler()
export CXX="$comp"
if [ -n "$flag" ]
then
case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags $flag)"
;;
esac
export CXXFLAGS="$flag"
fi
fi
}
# Export linker settings for CMake/configure
exportLinker()
{
......
......@@ -127,7 +127,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL
......@@ -367,6 +367,10 @@ Features selected
python ${withPYTHON:-false}
qt ${withQT:-false}
---------------------
Compiler
cxx ${CXX:-unknown}
flags ${CXXFLAGS:-none}
---------------------
Version information
paraview ${ParaView_VERSION:-unknown}
major ${ParaView_MAJOR:-unknown}
......
......@@ -103,7 +103,7 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL
......@@ -293,6 +293,10 @@ Features selected
mesa ${withMESA:-false}
mpi ${withMPI:-false}
---------------------
Compiler
cxx ${CXX:-unknown}
cxxflags ${CXXFLAGS:-none}
---------------------
Version information
vtk ${VTK_VERSION:-unknown}
build ${BUILD_TYPE:-unknown}
......
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