openfoam/etc/bashrc
Mark Olesen 778796853d CONFIG: enable use of stricter deprecation warnings
- selected with '+strict' in WM_COMPILE_CONTROL or 'wmake -strict', it
  enables the FOAM_DEPRECATED_STRICT() macro, which can be used to
  mark methods that are implicitly deprecated, but are not yet marked
  as full deprecated (eg, API modification is too recent, generates
  too many warnings).  Can be considered a developer option.
2023-08-21 08:39:36 +02:00

206 lines
7.5 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/bashrc
#
# Description
# The OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...).
# Source manually or from the ~/.bashrc or ~/.profile files.
#
# Most settings can be overridden with a <prefs.sh> file:
#
# - Base values (eg, from system admin):
# - $WM_PROJECT_DIR/etc/prefs.sh
#
# - User or group values (first file found):
# - ~/.OpenFOAM/$FOAM_API/prefs.sh
# - ~/.OpenFOAM/prefs.sh
# - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
# - $WM_PROJECT_SITE/etc/prefs.sh
#
# Some settings can also be overridden on the command-line when
# sourcing this file. For example,
#
# . /path/etc/bashrc WM_COMPILER=Clang WM_LABEL_SIZE=64
#
# Environment
# FOAM_CONFIG_ETC
# - alternative/additional location for OpenFOAM etc/ directory
#
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
# - no influence on OpenFOAM applications, just the config files
#
# FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files
#
# WM_PROJECT_SITE (optional directory)
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
#
# Note
# Changes made to this file will be lost with the next upgrade.
#
#------------------------------------------------------------------------------
# [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com
export WM_PROJECT_VERSION=com
#------------------------------------------------------------------------------
# Configuration environment variables.
# Override with <prefs.sh> instead of editing here.
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Clang | Icc | Icx | Amd | Arm | Cray | Fujitsu | Nvidia |
# Gcc<digits> | Clang<digits>
export WM_COMPILER=Gcc
# [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP | SPDP
export WM_PRECISION_OPTION=DP
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
export WM_LABEL_SIZE=32
# [WM_COMPILE_OPTION] - Optimised(default), debug, profiling, other:
# = Opt | Dbg | Debug | Prof
export WM_COMPILE_OPTION=Opt
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
# +gold : with gold linker
# +lld : with lld linker (with clang)
# +mold : with mold linker (with clang)
# ~libz : without libz compression
# ~rpath : without rpath handling [MacOS]
# +openmp : with openmp
# ~openmp : without openmp
# +ccache : use ccache
# +xcrun : use xcrun and native compilers [MacOS]
# +strict : more deprecation warnings (may generate *many* warnings)
# ccache=... : ccache command (unquoted, single/double or <> quoted)
# version=... : compiler suffix (eg, "11" for gcc-11)
#export WM_COMPILE_CONTROL="+gold"
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
# Specify SYSTEMOPENMPI1, SYSTEMOPENMPI2 for internal tracking (if desired)
# Can also use INTELMPI-xyz etc and define your own wmake rule
export WM_MPLIB=SYSTEMOPENMPI
#------------------------------------------------------------------------------
# (advanced / legacy)
# [WM_PROJECT] - This project is "OpenFOAM" - do not change
export WM_PROJECT=OpenFOAM
# [projectDir] - directory containing this OpenFOAM version.
# \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines
# should work when sourced by BASH or ZSH shells. If this however fails,
# set one of the fallback values to an appropriate path.
#
# This can be removed if an absolute path is provided for WM_PROJECT_DIR
# later on in this file
# --
projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}";
[ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/.. && \pwd -L)" ||\
projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# projectDir="/opt/openfoam/OpenFOAM-$WM_PROJECT_VERSION"
# projectDir="/usr/local/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
################################################################################
# Or optionally hard-coded (eg, with autoconfig)
# projectDir="@PROJECT_DIR@"
: # Safety statement (if the user removed all fallback values)
# [FOAM_SIGFPE] - Trap floating-point exceptions.
# - overrides the 'trapFpe' controlDict entry
# = true | false
#export FOAM_SIGFPE=true
# [FOAM_SETNAN] - Initialize memory with NaN
# - overrides the 'setNaN' controlDict entry
# = true | false
#export FOAM_SETNAN=false
# [FOAM_ABORT] - Treat exit() on FatalError as abort()
# = true | false
#export FOAM_ABORT=false
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
# [FOAM_JOB_DIR] - location of jobControl
# - unset: equivalent to ~/.OpenFOAM/jobControl
# export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"
# [WM_OSTYPE] - Operating System Type (set automatically)
# = POSIX | MSwindows
#export WM_OSTYPE=POSIX
# [WM_ARCH_OPTION] - compiling with -m32 option on 64-bit system
# = 32 | 64
# * on a 64-bit OS this can be 32 or 64
# * on a 32-bit OS this option is ignored (always 32-bit)
#export WM_ARCH_OPTION=64
# [FOAM_EXTRA_CFLAGS, FOAM_EXTRA_CXXFLAGS, FOAM_EXTRA_LDFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.sh> to avoid surprises.
unset FOAM_EXTRA_CFLAGS FOAM_EXTRA_CXXFLAGS FOAM_EXTRA_LDFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
# Capture values of old directories to be cleaned from PATH, LD_LIBRARY_PATH
foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
$HOME/$WM_PROJECT/${USER:-user} $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \
$WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN \
$FOAM_MODULE_APPBIN $FOAM_MODULE_LIBBIN"
# [WM_PROJECT_DIR] - Location of this OpenFOAM version
export WM_PROJECT_DIR="$projectDir"
# [WM_PROJECT_USER_DIR] - Location of user files
export WM_PROJECT_USER_DIR="$HOME/$WM_PROJECT/${USER:-user}-$WM_PROJECT_VERSION"
# [WM_PROJECT_SITE] - Location of site-specific (group) files
# Default (unset) implies WM_PROJECT_DIR/site
# Normally defined in calling environment
# Finalize setup of OpenFOAM environment
if [ -d "$WM_PROJECT_DIR" ]
then
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
echo "source $WM_PROJECT_DIR/etc/config.sh/setup" 1>&2
fi
. "$WM_PROJECT_DIR/etc/config.sh/setup" "$@"
else
echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION" 1>&2
echo "No directory: $WM_PROJECT_DIR" 1>&2
fi
# Cleanup variables (done as final statement for a clean exit code)
unset foamOldDirs projectDir
#------------------------------------------------------------------------------