mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
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 https://develop.openfoam.com/Development/OpenFOAM-plus/issues/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.
This commit is contained in:
@ -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}
|
||||
|
||||
6
makeVTK
6
makeVTK
@ -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}
|
||||
|
||||
Reference in New Issue
Block a user