openfoam/modules
Mark Olesen 79993bba43 CONFIG: support explicit selection of 'ld' linker
- 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
2023-12-15 16:17:12 +01:00
..
adios@b13298ef3b SUBMODULE: updates for adios, avalanche, external-solver 2023-06-21 15:31:47 +02:00
avalanche@858fff2b2a SUBMODULE: update avalanche, visualization 2023-12-11 15:56:00 +01:00
cfmesh@c0af229783 SUBMODULE: turbulence-community: add new submodule 2023-11-23 09:42:33 +00:00
doc DOC: update modules/README.md and Cross-Compile-mingw information 2020-06-17 00:01:22 +02:00
external-solver@5841a4a0e8 SUBMODULE: updates for adios, avalanche, external-solver 2023-06-21 15:31:47 +02:00
OpenQBMM@253d099ee9 SUBMODULE: updates for OpenQBMM 2023-06-22 17:28:08 +02:00
turbulence-community@1986462f26 SUBMODULE: turbulence-community: add new submodule 2023-11-23 09:42:33 +00:00
visualization@ae57b7c438 SUBMODULE: update avalanche, visualization 2023-12-11 15:56:00 +01:00
Allwmake COMP: add -pthread for AMD compiler rule 2021-12-15 19:13:27 +01:00
list-modules CONFIG: support explicit selection of 'ld' linker 2023-12-15 16:17:12 +01:00
README.md DOC: misc updates to doc files 2020-06-23 10:18:32 +02:00

[[TOC]]

OpenFOAM Modules

This directory is a location for additional OpenFOAM components or tools to placed and have them built as part of the normal OpenFOAM build process. It is assumed that each subdirectory contain an appropriate Allwmake (or Allwmake.override) file.

Build locations

Any individual module will normally also be able to exist outside of the module directory structure and will typically build into user locations ($FOAM_USER_APPBIN, $FOAM_USER_LIBBIN).

When compiled from the top-level OpenFOAM Allwmake or the modules/Allwmake, they should build into OpenFOAM project locations ($FOAM_APPBIN, $FOAM_LIBBIN). This can be adjusted by supplying an alternative -prefix= to the corresponding Allwmake command.

Command Install location
./Allwmake -prefix=user $FOAM_USER_APPBIN, $FOAM_USER_LIBBIN
./Allwmake -prefix=group $FOAM_SITE_APPBIN, $FOAM_SITE_LIBBIN
./Allwmake -prefix=openfoam $FOAM_APPBIN, $FOAM_LIBBIN
./Allwmake -prefix=/some/pathname /some/pathname/bin, /some/pathname/lib

Adding additional components

These additional components may be added as git submodules, by script or by hand.

git

On the first use, it will be necessary to register the submodules:

git submodule init

This will clone the relevant submodules from their respective repositories.

The following will indicate the current state:

git submodule status

On the first use, or after merging upstream changes in the OpenFOAM repository, it will be necessary to update the submodules:

git submodule update

A quick overview of git submodule can be in this blog with full details in the manpage.

An easy way to see which submodules are actually in use:

cat .gitmodules

Which will reveal content resembling the following:

[submodule "avalanche"]
    path = modules/avalanche
    url = https://develop.openfoam.com/Community/avalanche.git
[submodule "cfmesh"]
    path = modules/cfmesh
    url = https://develop.openfoam.com/Community/integration-cfmesh.git
...

Documentation (doxygen)

To build the doxygen information for the components, it is also necessary to link the directories to the doc/ subdirectory. This is a purely manual operation.

Developer Information

Build locations

To accomodate building into various locations, the module code should be adapted with the following changes:

  • Make/files

    ...
    EXE = $(FOAM_MODULE_APPBIN)/someExecutable
    
    LIB = $(FOAM_MODULE_LIBBIN)/libSomeLibrary
    
  • Make/options should include this

    include $(GENERAL_RULES)/module-path-user
    ...
    

The following changes to Make/options are universally applicable (ie, work with older or other versions of OpenFOAM), but more verbose.

  • Make/options with the following
    sinclude $(GENERAL_RULES)/module-path-user
    
    /* Failsafe - user locations */
    ifeq (,$(FOAM_MODULE_APPBIN))
    FOAM_MODULE_APPBIN = $(FOAM_USER_APPBIN)
    endif
    ifeq (,$(FOAM_MODULE_LIBBIN))
    FOAM_MODULE_LIBBIN = $(FOAM_USER_LIBBIN)
    endif
    ...