- for clang-based compilers the default linker may be lld or simply ld.
Support '+link-ld' to explicitly select use of the ld linker.
- consolidate linker rules into single files
STYLE: adjust SPDX Identifier
- 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.
- since the Apple SIP (System Integrity Protection) clears environment
variables such as DYLD_LIBRARY_PATH, a number of workarounds have
been used to provide shadow values. However, for a more robust
installation using -rpath at compilation time appears to be the
better solution.
In addition to the usual -rpath specification with absolute file
paths, MacOS supports (@loader_path, @executable_path) as well.
Now default to link with rpath information for MacOS, which can be
disabled by adding `~rpath` in WM_COMPILE_CONTROL
Explicit library paths handled:
- FOAM_FOAM_EXT_LIBBIN, FOAM_EXT_LIBBIN/FOAM_MPI
The executable rpaths are handled assuming a structure of
install-path/bin
install-path/lib/$(FOAM_MPI)
install-path/lib
Absolute compile-time paths for FOAM_USER_LIBBIN, FOAM_SITE_LIBBIN
and FOAM_LIBBIN are not handled since these are either too fragile
(FOAM_USER_LIBBIN and FOAM_SITE_LIBBIN values) or covered via
@loader_path anyhow (FOAM_LIBBIN).
Since the value of FOAM_MPI is a compile-time value, this rpath
treatment makes the installation less suitable for runtime changes
to the MPI vendor/version.
Note: no rpath added for c-only compilations since there are
currently no c-only libraries or executables with dynamic loading
- eg, for partially incomplete systems (without libz devel header)
ENH: clearer binding of dummy Pstream in OpenFOAM/Make/options
- link of dummy stub Pstream now contingent on linking libOpenFOAM as
well. This makes the purpose slightly clearer
ENH: cleaner option naming/handling in wmake script
- allow special purpose -no-openfoam option.
Eg, compiling test programs without OpenFOAM and Pstream libraries
but using the rest of the wmake system.
ENH: add +openmp support into WM_COMPILE_CONTROL (#2633)
- this adds compile/link flags for openmp.
For single-use, can also use 'wmake -openmp'.
If both +openmp and ~openmp are specified in WM_COMPILE_CONTROL
the ~openmp will have priority.
This is actually done indirectly since ~openmp will set empty
COMP_OPENMP, LINK_OPENMP internal variables, which the +openmp then
adds to the c++FLAGS and linkexe targets (ie, won't actually add
anything).
ENH: add +ccache or ccache=... support into WM_COMPILE_CONTROL (#2633)
- with the first version (+ccache), simply use ccache from the path
without any extra options.
- with the second version (ccache=...), can be more specific about
what is called.
Using "+ccache" is identical to "ccache=ccache", but the later could
be used in other ways. For example,
ccache=/strange/install/path/ccache
ccache=</path/my-tooling --option>
Have the choice of unquoted, single or double quoted or '< >' quoted
STYLE: relocate FOAM_EXTRA_LDFLAGS in general makefile
- removes clutter for different linkers (eg, gold, mold, ldd)
making it easier to extend for other linkers.
STYLE: protect makefile checks with 'strip' function
- uses '-g -DFULLDEBUG' (like Debug), but with -O3 (like Opt).
This adds in debug symbols and FULLDEBUG code segments (good for
code development) but retains -O3 optimizations and code paths and
avoids the much slower -O0 associated with 'Debug'.
- add in central wmake/General/common/{c,c++}XXX tuning,
which helps reduce the number of nearly identical files
ENH: add support for wmake -debug-Og
Eg,
export WM_COMPILER=Clang130
export WM_COMPILE_CONTROL="version=13.0 +lld"
- also support the mold linker (+mold) for clang
STYLE: report as 'link' stage instead of 'ld' in short messages
- for compilers such as gcc and clang, may have several different
variants installed on the computer. Use WM_COMPILER_CONTROL to
specify the preferred variant.
Eg,
WM_COMPILER=Gcc
WM_COMPILER_CONTROL="version=8"
will compile with "gcc-8" and "g++-8"
Good practice would be to tag output directory names with the
version too. Eg
WM_COMPILER=Clang110
WM_COMPILER_CONTROL="version=11.0"
STYLE: modify message for change of gcc -> clang (darwin)
- migrate to c++14 for most compilers *except* gcc.
There are still many systems in use with gcc-4.8.5, which does not
support c++14.
- initial rules for nvidia compilers (pgi is will soon be defunct).
Not fully tested...
CONFIG: provide fallback value for the user directory name
- in containers may have an unset USER env variable.
Default to 'user' to prevent ugly looking directory names.
- largely as per patch from Jong-Gwan (Jason) Do
NB: the intel-one setup adds in paths for intelmpi.
Its mpicc version does not harmonize with the OpenFOAM
system openmpi setup (using mpicc --showme:link).
Needs adjustment, or use intelmpi instead.
- update name mappings for newer gcc, clang versions
- prefix FOAM_MPI and library directories with 'sys-' for system
versions for uniform identication.
WM_MPLIB | libdir (FOAM_MPI) | old naming |
SYSTEMMPI | sys-mpi | mpi |
SYSTEMOPENMPI | sys-openmpi | openmpi-system |
- prefix preferences with 'prefs.' to make them more easily
identifiable, and update bin/tools/create-mpi-config accordingly
Old name: config.{csh,sh}/openmpi
New name: config.{csh,sh}/prefs.openmpi
- additional mpi preferences now available:
* prefs.intelmpi
* prefs.mpich
...
CONFIG: added hook for EASYBUILDMPI (eb-mpi), somewhat like USERMPI
- EasyBuild uses mpicc when compiling, so no explicit wmake rules are
used
ENH: support different major versions for system openmpi
- for example, with
WM_MPLIB=SYSTEMOPENMPI2
defines FOAM_MPI=sys-openmpi2 and thus creates lib/sys-openmpi2
ENH: centralize handling of mpi as 'mpi-rules'
Before:
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
ifeq (,$(FOAM_MPI_LIBBIN))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif
After:
include $(GENERAL_RULES)/mpi-rules
- also allows variants such as SYSTEMOPENMPI2 to be handled separately
- consistent with FOAM_SIGFPE etc.
- centralize code as error::useAbort() static function to avoid
scattering the logic throughout the code.
ENH: also accept "0" and "1" string values for Switch
- not the normal path for Switch input (eg, from a dictionary), but
consistent with bool definitions and simplifies string parsing.
This means that `FOAM_SIGFPE=1 application` will now also work.
- introduce WM_COMPILE_CONTROL variable to convey control information
into the build rules.
The convention (as per spack):
- '+' to select a feature
- '~' to deselect a feature
Eg, to select the gold linker, and disable openmp
(spaces are not required):
WM_COMPILE_CONTROL="+gold ~openmp"
CONFIG: accept FOAM_EXTRA_LDFLAGS for AMD, gold, Mingw linkers
CONFIG: generalize PROJECT_LIBS (-ldl used almost universally)
- When compiling additional modules or user code, we need more control
for the installation locations beyond the usual FOAM_USER_LIBBIN,
FOAM_SITE_LIBBIN, FOAM_LIBBIN, and wish to have these values be
modifiable without editing files.
- provide wmake rules for handling standard defaults:
* GENERAL_RULES/module-path-user
* GENERAL_RULES/module-path-group
* GENERAL_RULES/module-path-project
which are incorporated as follows:
Make/options:
include $(GENERAL_RULES)/module-path-user
Make/files:
LIB = $(FOAM_MODULE_LIBBIN)/libMyLibrary
By default these would compile into FOAM_USER_{APPBIN,LIBBIN} but
could be adjusted at compilation time. For example,
```
wmake -module-prefix=/path/my-install-location
```
Or
```
./Allwmake -module-prefix=/path/my-install-location
./Allwmake -prefix=/path/my-install-location
```
Or
```
FOAM_MODULE_PREFIX=/path/my-install-location ./Allwmake
```
ENH: add -no-recursion option for AllwmakeParseArguments
- more descriptive naming than the -fromWmake option (still supported)
- remove wmake/scripts/wmake.{cmake,wmake}-args since the -prefix
handling and -no-recursion is now directly handled by AllwmakeParseArguments
- use Clang instead of Gcc for Darwin since this is its system
compiler. The user can force use of Gcc by using Gcc92 etc.
- make etc/cshrc sed check more robust.
- replace tcsh (${%var}) syntax with ("${var}" != "")
[Fixes and ideas from Alexey Matveichev]
CONFIG: do not source the gperftools environment by default
- this is now an used feature, but can be re-enabled by advanced users
if required.
- missed detection of system libraries when installed with multiarch
paths like /usr/lib/x86_64-linux-gnu
CONFIG: improve handling of group/user config files (#928)
- changed bashrc handling of FOAM_CONFIG_NOUSER to use
FOAM_CONFIG_MODE instead. Propagate into foamEtcFile to make this
a stickier control.
This change allows better control, but also enables cluster
installations to define their own value within the OpenFOAM prefs.sh
file to prevent users accidentally mis-configuring things if
necessary.
- remove undocumented handling of an (a)ll mode in foamEtcFile to
avoid potential pitfalls.
- add support for FOAM_CONFIG_ETC handling.
This allows injection of an extra search layer when finding
project etc files
ENH: improvements to foamConfigurePaths (#928)
- handle FOAM_CONFIG_ETC implicitly, or explicitly with the new
-etc option.
STYLE: more explicit wording in foamConfigurePaths usage (#1602)
- document that an absolute path (eg, -scotch-path) overrides/ignores
the equivalent ThirdParty setting (eg, -scotch)
- longer options -system-compiler and -third-compiler for -system
and -third, respectively. Clearer as to their purpose.
- adjust the location sanity check to look for META-INFO directory.
- '-c' option (as per shell), '-Dkey[=value]' option to provide
preferences via the command-line. For example,
etc/openfoam -DWM_COMPILER=Clang -int64 ./Allwmake -j -s -l
These can also be combined with other options. Eg,
etc/openfoam -DWM_COMPILER=Clang \
-c 'wmake -show-path-cxx -show-cxxflags'
- relocated from bin/tools/ => etc/ for easier access
- bin/tools/openfoam.in : for autoconfig-style installation
- Auto-detect if the shell script was executed with openfoam and
interpret accordingly.
Simple example,
--------------
#!/usr/bin/openfoam
cd "${0%/*}" || exit # Run -*-sh-*- from this dir
blockMesh
simpleFoam
--------------
Note it is NOT currently possible to provide any other parameters
this way. Eg,
`#!/usr/bin/openfoam -sp` (NOT)
This will either fail to run, or result in infinite recursion.
- locate where the user is less tempted to change it (#1515).
It really should be considered an invariant environment variable.
STYLE: wmake -help information to stdout, die errors to stderr
- call also be used non-interactively for simple 'one-shot' use of
OpenFOAM utilities or solvers
STYLE: use dash instead of brackets for '- see www.OpenFOAM.com'
- less cluttered in combination with API information
- add a '-SPDP' option
- remove the '-archOption' for forcing a '-m32' build on 64-bit
architecture, which is now considered too obscure.
Must edit files manually if this option is really required.
- now only needed when specify compiling -m32 on a 64-bit system.
Internally use the __SIZEOF_LONG__ compiler macro (gcc, icc, llvm)
to define when long is actually an int32_t.