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
The preprocessor ```fypp``` (https://github.com/aradi/fypp) is needed because metaprogramming is used.
46
-
It can be installed using the command line installer ```pip```.
46
+
To build the Fortran standard library you need
47
+
48
+
- a Fortran 2008 compliant compiler, or better, a Fortran 2018 compliant compiler
49
+
(GCC Fortran and Intel Fortran compilers are known to work for stdlib)
50
+
- CMake version 3.14 or newer (alternatively Make can be used)
51
+
- a build backend for CMake, like Make or Ninja (the latter is recommended on Windows)
52
+
- the [fypp](https://github.com/aradi/fypp) preprocessor (used as meta-programming tool)
53
+
54
+
If your system package manager does not provide the required build tools, all build dependencies can be installed with the Python command line installer ``pip``:
55
+
56
+
```sh
57
+
pip install --user fypp cmake ninja
58
+
```
59
+
60
+
Alternatively, you can install the build tools from the conda-forge channel with the conda package manager:
61
+
47
62
```sh
48
-
pip install fypp
63
+
conda config --add channels conda-forge
64
+
conda create -n stdlib-tools fypp cmake ninja
65
+
conda activate stdlib-tools
49
66
```
50
67
68
+
You can install conda using the [miniforge installer](https://github.com/conda-forge/miniforge/releases).
69
+
Also, you can install a Fortran compiler from conda-forge by installing the ``fortran-compiler`` package, which installs GFortran.
70
+
71
+
72
+
### Supported Compilers
73
+
74
+
The following combinations are tested on the default branch of stdlib:
NAG | 7.0 | RHEL | x86_64 | [#108](https://github.com/fortran-lang/stdlib/issues/108)
93
+
Intel Parallel Studio XE | 16, 17, 18 | OpenSUSE | x86_64 | failed to compile
94
+
95
+
Please share your experience with successful and failing builds for compiler/platform/architecture combinations not covered above.
96
+
97
+
51
98
### Build with CMake
52
99
100
+
Configure the build with
101
+
53
102
```sh
54
103
cmake -B build
104
+
```
105
+
106
+
You can pass additional options to CMake to customize the build.
107
+
Important options are
108
+
109
+
-`-G Ninja` to use the Ninja backend instead of the default Make backend. Other build backends are available with a similar syntax.
110
+
-`-DCMAKE_INSTALL_PREFIX` is used to provide the install location for the library.
111
+
-`-DCMAKE_MAXIMUM_RANK` the maximum array rank procedures should be generated for.
112
+
The default is 15 for Fortran 2003 compliant compilers, otherwise 7 for compilers not supporting Fortran 2003 completely yet.
113
+
The minimum required rank to compile this project is 4.
114
+
Compiling with maximum rank 15 can be resource intensive and requires at least 16 GB of memory to allow parallel compilation or 4 GB memory for sequential compilation.
115
+
-`-DBUILD_SHARED_LIBS` set to `on` in case you want link your application dynamically against the standard library (default: `off`).
55
116
117
+
For example, to configure a build using the Ninja backend and generating procedures up to rank 7, which is installed to your home directory use
To test your build, run the test suite after the build has finished with
57
130
131
+
```sh
58
132
cmake --build build --target test
59
133
```
60
134
61
-
### Build with make
135
+
Please report failing tests on our [issue tracker](https://github.com/fortran-lang/stdlib/issues/new/choose) including details on the compiler used, the operating system and platform architecture.
62
136
63
-
Alternatively, you can build using provided Makefiles:
137
+
To install the project to the declared prefix run
64
138
139
+
```sh
140
+
cmake --install build
65
141
```
66
-
make -f Makefile.manual
67
-
```
68
142
69
-
## Limiting the maximum rank of generated procedures
143
+
Now you have a working version of stdlib you can use for your project.
144
+
145
+
146
+
### Build with make
70
147
71
-
Stdlib's preprocessor (fypp) by default generates specific procedures for arrays of all ranks, up to rank 15.
72
-
This can result in long compilation times and, on some computers, exceeding available memory.
73
-
If you know that you won't need all 15 ranks, you can specify the maximum rank for which the specific procedures will be generated.
74
-
For example, with CMake:
148
+
Alternatively, you can build using provided Makefiles:
75
149
76
150
```sh
77
-
cmake -B build -DCMAKE_MAXIMUM_RANK=4
78
-
cmake --build build
79
-
cmake --build build --target test
151
+
make -f Makefile.manual
80
152
```
81
-
or as follows with `make`:
153
+
154
+
You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``FYPPFLAGS`` environment variable:
82
155
83
156
```sh
84
157
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
85
158
```
86
-
Note that currently the minimum value for maximum rank is 4.
159
+
160
+
161
+
162
+
## Using stdlib in your project
163
+
164
+
The stdlib project exports CMake package files and pkg-config files to make stdlib usable for other projects.
165
+
The package files are located in the library directory in the installation prefix.
166
+
167
+
For CMake builds of stdlib you can find a local installation with
168
+
169
+
```cmake
170
+
find_package(fortran_stdlib REQUIRED)
171
+
...
172
+
target_link_libraries(
173
+
${PROJECT_NAME}
174
+
PRIVATE
175
+
fortran_stdlib::fortran_stdlib
176
+
)
177
+
```
178
+
179
+
To make the installed stdlib project discoverable add the stdlib directory to the ``CMAKE_PREFIX_PATH``.
180
+
The usual install localtion of the package files is ``$PREFIX/lib/cmake/fortran_stdlib``.
181
+
182
+
For non-CMake build systems (like make) you can use the exported pkg-config file by setting ``PKG_CONFIG_PATH`` to include the directory containing the exported pc-file.
183
+
The usual install location of the pc-file is ``$PREFIX/lib/pkgconfig``.
184
+
In make you can obtain the required compile and link arguments with
Documentation is a work in progress (see issue #4) but is currently available at https://stdlib.fortran-lang.org.
193
+
Documentation is a work in progress (see issue [#4](https://github.com/fortran-lang/stdlib/issues/4)) but already available at [stdlib.fortran-lang.org](https://stdlib.fortran-lang.org).
91
194
This includes API documentation automatically generated from static analysis and markup comments in the source files
92
195
using the [FORD](https://github.com/Fortran-FOSS-programmers/ford/wiki) tool,
93
196
as well as a specification document or ["spec"](https://stdlib.fortran-lang.org/page/specs/index.html) for each proposed feature.
0 commit comments