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
Fortran error handling frameworks are few and far between, and those that do exist often implement only parts of the error handling process, or rely on pre-processors. The goal of this error handling framework is to provide a universal and comprehensive solution for applications requiring functional and robust error handling, utilising the power of modern object-oriented Fortran.
4
7
5
8
-[Getting started](#getting-started)
@@ -12,9 +15,42 @@ Fortran error handling frameworks are few and far between, and those that do exi
12
15
<aname="getting-started"></a>
13
16
## Getting started
14
17
15
-
If you wish to use the Fortran Error Handler in a project, the simplest way to do so is to include the source files (in `src/`) 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.
18
+
There are a few ways to get the Fortran Error Handler into your project.
19
+
20
+
### `fpm` - Fortran Package Manager
21
+
22
+
The simplest way is to use [fpm (Fortran Package Manager)](https://fpm.fortran-lang.org/en/index.html). You can either directly include the Fortran Error Handler as a dependency in your `fpm.toml` file:
Or you can clone the repo and build the library yourself using fpm:
16
30
17
-
The code can also be compiled using `cmake`, which creates an example executable (using `example/example_usage.f90`), an executable of unit tests (using `tests/run_tests.f90`), and a library of the framework:
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
+
39
+
You can also get fpm to install the Fortran Error Handler locally (e.g. to `/home/<user>/.local`):
40
+
41
+
```bash
42
+
$ fpm install --flag="-fbackslash"
43
+
```
44
+
45
+
Fpm can easily be installed using Conda: `conda install -c conda-forge fpm`.
46
+
47
+
### Grab the files
48
+
49
+
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
+
51
+
### `cmake`
52
+
53
+
The code can also be compiled using `cmake`, which generates a library and `.mod` files, an example executable, and executable of unit tests.
18
54
19
55
```bash
20
56
$ mkdir build
@@ -27,12 +63,6 @@ $ ./test
27
63
$ ./example
28
64
```
29
65
30
-
Whether the library is shared or not is specified by the `BUILD_SHARED_LIBS` variable. If you wish to build a shared library, then pass the `BUILD_SHARED_LIBS` option as on:
31
-
32
-
```bash
33
-
$ cmake .. -DBUILD_SHARED_LIBS=ON
34
-
```
35
-
36
66
The framework has been tested using GFortran 7 upwards and Intel Fortran 18.
0 commit comments