ENH: improved handling of gmp/mpfr library settings (issue #674)

- export library path for gmp/mpfr from CGAL config files.
  This is required when non-system gmp/mpfr libraries are being
  used, but not using a ThirdParty compiler installation.

- automatically handle lib/ vs lib64/ (eg, for central installations)
  for packages such as boost, CGAL, etc. While the ThirdParty
  compilation of these will normally land in lib64/, this may not be
  the case when they are supplied by another means.

- reworked the handling of foamEtcFile and foamCleanPath for less
  clutter in the configuration files.
  Added the bin/tools/lib-dir script to handle logic that is
  too complex to easily manage in csh.
This commit is contained in:
Mark Olesen
2018-01-11 01:30:23 +01:00
parent 2d51d4b340
commit 110b00f048
47 changed files with 763 additions and 383 deletions

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,16 @@
#
# File
# etc/config.sh/mpi
# - sourced by OpenFOAM-*/etc/bashrc
#
# Description
# Setup for MPI communications library for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
#
# User adjustments are possible in these files:
# - config.sh/openmpi-system
# - config.sh/openmpi
# - config.sh/mpi-user
# - config.sh/mpi-system
#
# For USERMPI, the user is responsible for supplying an appropriate
# wmake/rules/General/mplibUSERMPI file and managing all settings
@ -25,31 +31,41 @@ export FOAM_MPI=dummy # Fallback value
case "$WM_MPLIB" in
SYSTEMOPENMPI)
# Use the system installed openmpi, get library directory via mpicc
# The system installed openmpi, locations discovery via mpicc.
export FOAM_MPI=openmpi-system
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -z "$($foamClean "$OPAL_PREFIX" "$foamOldDirs")" ]
if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
then
unset OPAL_PREFIX
fi
_foamEtc -config openmpi-system # <- Adjustments (optional)
# Bit of a hack: strip off 'lib' and assume it is the prefix for openmpi
# include files and libraries.
libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')
# Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
if [ -d "$MPI_ARCH_PATH" ]
then
_foamAddLibAuto $MPI_ARCH_PATH
else
# Slight hack: strip off 'lib' to get presumed prefix for include and libs
libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')
export MPI_ARCH_PATH="${libDir%/*}"
_foamAddLib $libDir
unset libDir
export MPI_ARCH_PATH="${libDir%/*}"
_foamAddLib $libDir
unset libDir
fi
;;
OPENMPI)
export FOAM_MPI=openmpi-1.10.4
_foamEtc config.sh/openmpi # <- Adjustments (optional)
_foamEtc -config openmpi # <- Adjustments (optional)
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
if [ ! -d "$MPI_ARCH_PATH" ]
then
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
fi
# Tell OpenMPI where to find its install directory
# Inform openmpi where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH
if [ "$FOAM_VERBOSE" -a "$PS1" ]
@ -60,23 +76,23 @@ OPENMPI)
fi
# Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
fi
;;
USERMPI)
# Use an arbitrary, user-specified mpi implementation
export FOAM_MPI=mpi-user
_foamEtc config.sh/mpi-user # <- Adjustments
_foamEtc -config mpi-user # <- Adjustments (optional)
;;
SYSTEMMPI)
export FOAM_MPI=mpi-system
_foamEtc config.sh/mpi-system # <- Adjustments (optional)
_foamEtc -config mpi-system # <- Adjustments (optional)
if [ -z "$MPI_ROOT" ]
then
@ -129,11 +145,11 @@ MPICH)
export MPI_HOME=$MPI_ARCH_PATH
# Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
fi
;;