You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Fortran error handling frameworks are few and far between, and those that do exi
15
15
<aname="getting-started"></a>
16
16
## Getting started
17
17
18
-
There are a few ways to get the Fortran Error Handler into your project.
18
+
There are a few ways to get the Fortran Error Handler into your project. The following have been tested with recent version of the GFortran and Intel Fortran compiler (`ifort`, not `ifx`).
19
19
20
20
### `fpm` - Fortran Package Manager
21
21
@@ -31,15 +31,14 @@ Or you can clone the repo and build the library yourself using fpm:
A static library (e.g. `libfeh.a` on Linux) and `.mod` files will be generated in the `build` directory for you to use. An example executable (using `example/example_usage.f90`) will also be generated. Running `fpm test` will run tests (using `tests/run_tests.f90`) for the framework. The `-fbackslash` flag is a GFortran flag to enable coloured terminal output, and is only needed if the `bashColors` option is `.true.` (default). The equivalent `ifort` flag is `/assume:bscc`.
38
-
37
+
A static library (e.g. `libfeh.a` on Linux) and `.mod` files will be generated in the `build` directory for you to use. An example executable (using `example/example_usage.f90`) will also be generated. Running `fpm test` will run tests (using `tests/run_tests.f90`) for the framework.
39
38
You can also get fpm to install the Fortran Error Handler locally (e.g. to `/home/<user>/.local`):
40
39
41
40
```bash
42
-
$ fpm install --flag="-fbackslash"
41
+
$ fpm install
43
42
```
44
43
45
44
Fpm can easily be installed using Conda: `conda install -c conda-forge fpm`.
@@ -48,9 +47,29 @@ Fpm can easily be installed using Conda: `conda install -c conda-forge fpm`.
48
47
49
48
Another simple method is to simple grab a copy of the source files (in `src/`) and include at the start of your compilation setup. Source files should be compiled in this order: `ErrorInstance.f90`, `ErrorHandler.f90`, `ErrorCriteria.f90`, `Result.f90`. An example [Makefile.example](./Makefile.example) is included, which can be altered according to your compiler and preferences.
50
49
51
-
### `cmake`
50
+
### Meson
52
51
53
-
The code can also be compiled using `cmake`, which generates a library and `.mod` files, an example executable, and executable of unit tests.
52
+
If you use [meson](https://mesonbuild.com/), a [meson.build](./meson.build) file is provided. For example, if you want to build into the `buildmeson` directory:
53
+
54
+
```bash
55
+
$ meson buildmeson
56
+
$ ninja -C buildmeson
57
+
```
58
+
59
+
From meson 0.56, you can use the `meson compile` command instead of `ninja`. This will generate the example and test executables, a shared library and module files. You can run the tests directly using meson: `meson test -C buildmeson`.
60
+
61
+
By default, the library is built with a debug build type. To build for release (with `-O3` optimisations), specify this via the `--buildtype=release` option:
62
+
63
+
```bash
64
+
$ meson buildrelease --buildtype=release
65
+
$ ninja -C buildrelease
66
+
```
67
+
68
+
Installing using meson (`meson install`) isn't recommended at the moment as `.mod` files are not installed - see [this issue](https://github.com/mesonbuild/meson/issues/5374).
69
+
70
+
### CMake
71
+
72
+
The code can also be compiled using CMake, which similarly generates a library and `.mod` files, an example executable, and executable of unit tests.
54
73
55
74
```bash
56
75
$ mkdir build
@@ -63,8 +82,6 @@ $ ./test
63
82
$ ./example
64
83
```
65
84
66
-
The framework has been tested using GFortran 7 upwards and Intel Fortran 18.
67
-
68
85
<aname="usage"></a>
69
86
## Usage
70
87
@@ -187,9 +204,6 @@ Explore the documentation for each class to learn how to best use the framework,
187
204
## Caveats and limitations <aname="caveats"></a>
188
205
189
206
- Error code must be less than 99999.
190
-
- GFortran bugs:
191
-
-`-O1` or higher must be used to avoid "character length mismatch in array constructor" errors with allocatable character variables.
192
-
-`-fcheck=no-bounds` must be used to avoid errors on allocating rank-2 or higher arrays.
193
207
- Result objects only support up to rank-4 (4 dimensional) data.
194
208
- Limited support for different kinds, due to Fortran's lack of kind polymorphism. In particular, ErrorCriteria only accept 4-byte integers and single precision, double precision and quadruple precision reals, as such:
"description": "Comprehensive error framework for applications requiring functional and robust error handling, utilising the power of modern object-oriented Fortran.",
0 commit comments