... | ... | @@ -4,7 +4,8 @@ |
|
|
|
|
|
|Version | Build |
|
|
|
|--------|--------|
|
|
|
|v1906 | [Build][v1906-build] |
|
|
|
|v1912 | [Build][latest-build] |
|
|
|
|v1906 | [Build][latest-build] |
|
|
|
|
|
|
Older versions use a general [build guide webpage](https://www.openfoam.com/code/build-guide.php),
|
|
|
which will be replaced by alternative content in the future.
|
... | ... | @@ -209,6 +210,85 @@ reference purposes, and to help when scripting: |
|
|
| CentOS/RedHat | [openfoam-selector.spec](/packaging/redhat/openfoam-selector.spec) | [copr fetch](/packaging/redhat/copr-fetch.sh) |
|
|
|
|
|
|
|
|
|
### Different compiler versions
|
|
|
|
|
|
By default, OpenFOAM handles newer/older non-system compilers as
|
|
|
_ThirdParty_ installations and uses the combination of `WM_COMPILER`
|
|
|
and `WM_COMPILER_TYPE` to select them. In some cases, however, it can
|
|
|
be much more convenient for the user to install prebuilt compiler
|
|
|
binaries as *system* compilers (eg, using deb or rpm packages).
|
|
|
This poses a slight problem since the OpenFOAM build rules normally
|
|
|
use the main compiler name (`gcc`, `clang` etc) without any additional
|
|
|
version information, but the various *system* compilers are frequently
|
|
|
installed with versioned names such as `gcc-8`, `clang-9` etc.
|
|
|
|
|
|
Here is a simple way to solve this, using clang-9 on openSUSE for the
|
|
|
example:
|
|
|
|
|
|
1. Install the desired system compiler.
|
|
|
In this case [clang-9 from tools:compiler][llvm9-opensuse] which
|
|
|
installs `/usr/bin/clang-9` and `/usr/bin/clang++-9`.
|
|
|
|
|
|
2. Next override the OpenFOAM compiler calls, but without blindly
|
|
|
rewriting everything.
|
|
|
|
|
|
We create a new directory for our special rules:
|
|
|
```
|
|
|
mkdir wmake/rules/linux64Clang90
|
|
|
```
|
|
|
Inside this directory, we add a general rules file
|
|
|
(`wmake/rules/linux64Clang90/general`) with the following contents:
|
|
|
```
|
|
|
# Override compiler calls for llvm-9
|
|
|
|
|
|
cc = clang-9
|
|
|
CC = clang++-9 -std=c++11
|
|
|
```
|
|
|
Or if this shall be restricted to system compilers only:
|
|
|
```
|
|
|
# Override compiler calls for llvm-9
|
|
|
ifeq ($(WM_COMPILER_TYPE),system)
|
|
|
cc = clang-9
|
|
|
CC = clang++-9 -std=c++11
|
|
|
endif
|
|
|
```
|
|
|
|
|
|
3. The final step is to select this compiler definition with the following
|
|
|
combination:
|
|
|
```
|
|
|
# Preferences for system Clang90
|
|
|
|
|
|
export WM_COMPILER=Clang90
|
|
|
export WM_COMPILER_TYPE=system
|
|
|
```
|
|
|
|
|
|
If this change represents your standard default compiler definition,
|
|
|
then place the information into the `etc/prefs.sh` file (see the
|
|
|
`etc/bashrc` file for some details) and re-source your OpenFOAM
|
|
|
environment.
|
|
|
|
|
|
If you would like to selectively enable this compiler definition, a
|
|
|
common means is to place the same definition information into a user
|
|
|
configuration file (for example, `~/.OpenFOAM/clang90`) and then
|
|
|
specify that configuration when sourcing your OpenFOAM environment.
|
|
|
For example,
|
|
|
```
|
|
|
source /path/to/OpenFOAM-version/etc/bashrc clang90
|
|
|
```
|
|
|
|
|
|
The `bashrc` will locate and use the configuration file, after which the
|
|
|
compiler will be properly selected. To verify that this is indeed the
|
|
|
case:
|
|
|
```
|
|
|
wmake -show-cxx
|
|
|
```
|
|
|
should display the selected compiler. You may also wish to verify its
|
|
|
path:
|
|
|
```
|
|
|
wmake -show-path-cxx
|
|
|
```
|
|
|
For older versions, `which $(wmake -show-cxx)` instead.
|
|
|
|
|
|
|
|
|
## Darwin (Mac-OS)
|
|
|
|
... | ... | @@ -236,14 +316,16 @@ CGAL |
|
|
## Windows
|
|
|
|
|
|
Starting with [v1906][v1906-notes], Windows source compilation is
|
|
|
supported via [cross-compilation][v1906-cross] using the
|
|
|
supported via [cross-compilation][latest-cross] using the
|
|
|
[mingw](http://mingw.org/) compiler on 64bit Linux to generate a Win64 target.
|
|
|
See the version-relevant build information.
|
|
|
|
|
|
--
|
|
|
--------
|
|
|
|
|
|
[foam-readme]: https://develop.openfoam.com/Development/openfoam/blob/develop/README.md
|
|
|
|
|
|
[v1906-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
|
|
|
[v1906-cross]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Cross-Compile-mingw.md
|
|
|
[latest-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
|
|
|
[latest-cross]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Cross-Compile-mingw.md
|
|
|
[v1906-notes]: https://www.openfoam.com/releases/openfoam-v1906/
|
|
|
|
|
|
[llvm9-opensuse]: https://software.opensuse.org//download.html?project=devel%3Atools%3Acompiler&package=llvm9 |