openfoam/etc/config.csh/functions
Alexey Matveichev e827c117e3 CONFIG: fixes for MacOS (#2555)
- introduce a FOAM_LD_LIBRARY_PATH variable to shadow
  DYLD_LIBRARY_PATH on MacOS.

  The DYLD_LIBRARY_PATH and LD_LIBRARY_PATH cannot be modified via sub
  shells etc when SIP is active. This helps circumvent these
  restrictions, which is obviously a hack, but seems to be required.

COMP: disable -ftrapping-math in geompack for MacOS
2022-08-19 12:52:11 +02:00

91 lines
3.2 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/functions
# - sourced by OpenFOAM-*/etc/cshrc
#
# Description
# C-shell aliases and variables used when sourcing the OpenFOAM environment
#
# Some functionality implemented via bin/tools/lib-dir
#
# Defined Variables
# foamClean : path to bin/foamCleanPath
# _foam_uname_s : cache value for `uname -s`
#
# Defined Functions (Aliases)
# _foamClean : eval call to foamCleanPath for specific shell
# _foamEcho : silent/non-silent echo
# _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH
# _foamAddLibAuto: call to lib-dir for lib64/lib resolved name
#
#------------------------------------------------------------------------------
# Cleaning environment variables
alias _foamClean 'eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=\!*`'
# Cache value for `uname -s`
set _foam_uname_s=`uname -s`
# Prepend PATH, MANPATH, LD_LIBRARY_PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
# Special treatment for Darwin
# - DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH
if ("${_foam_uname_s}" == 'Darwin') then
alias _foamAddLib 'if (-e \!*) setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}; if (-e \!*) setenv FOAM_LD_LIBRARY_PATH \!*\:${FOAM_LD_LIBRARY_PATH}'
else
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
endif
# Prefix to LD_LIBRARY_PATH with additional checking
# $1 = base directory for 'lib' or 'lib64'
# $2 = fallback libname ('lib' or 'lib64')
alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
# Echo values when FOAM_VERBOSE is on, no-op otherwise
# Source an etc file, possibly with some verbosity
if ($?FOAM_VERBOSE && $?prompt) then
alias _foamEcho 'echo \!*'
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
else
alias _foamEcho 'true'
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
endif
#------------------------------------------------------------------------------
# Avoid any ThirdParty settings that may have 'leaked' into the environment
unsetenv MPI_ARCH_PATH
unsetenv ADIOS_ARCH_PATH
unsetenv ADIOS1_ARCH_PATH
unsetenv ADIOS2_ARCH_PATH
unsetenv BOOST_ARCH_PATH
unsetenv CCMIO_ARCH_PATH
unsetenv CGAL_ARCH_PATH
unsetenv FFTW_ARCH_PATH
unsetenv GPERFTOOLS_ARCH_PATH
unsetenv GMP_ARCH_PATH
unsetenv MPFR_ARCH_PATH
unsetenv LLVM_ARCH_PATH
unsetenv MESA_ARCH_PATH
unsetenv METIS_ARCH_PATH
unsetenv SCOTCH_ARCH_PATH
#------------------------------------------------------------------------------