Skip to content

Commit 5a9c6f6

Browse files
committed
Make it clearer how the user can control compiler optimization
1 parent 8bfcdf9 commit 5a9c6f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ cmake -B build
125125
You can pass additional options to CMake to customize the build.
126126
Important options are
127127

128-
- `-G Ninja` to use the Ninja backend instead of the default Make backend. Other build backends are available with a similar syntax.
128+
- `-G Ninja` to use the Ninja backend instead of the default Make backend. This makes it easy to specify compiler flags for the build. Other build backends are available with a similar syntax.
129129
- `-DCMAKE_INSTALL_PREFIX` is used to provide the install location for the library. If not provided the defaults will depend on your operating system, [see here](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html).
130130
- `-DCMAKE_MAXIMUM_RANK` the maximum array rank procedures should be generated for.
131131
The default value is chosen as 4.
@@ -134,9 +134,10 @@ Important options are
134134
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.
135135
- `-DBUILD_SHARED_LIBS` set to `on` in case you want link your application dynamically against the standard library (default: `off`).
136136

137-
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
137+
For example, to configure a build using the Ninja backend while specifying compiler flags `FFLAGS`, generating procedures up to rank 7, and installing to your home directory, use
138138

139139
```sh
140+
export FFLAGS="-O3 -flto -fPIC"
140141
cmake -B build -G Ninja -DCMAKE_MAXIMUM_RANK:String=7 -DCMAKE_INSTALL_PREFIX=$HOME/.local
141142
```
142143

@@ -177,6 +178,8 @@ You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``FYPPFLAGS
177178
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
178179
```
179180

181+
You can edit the compiler and its optimization flags by specifying the `FC` and `FFLAGS` variables in Makefile.manual. The default `FFLAGS` does not include any optimization, and you may want to add `-O3 -flto` to its definition.
182+
180183
### Build with [fortran-lang/fpm](https://github.com/fortran-lang/fpm)
181184

182185
Fortran Package Manager (fpm) is a package manager and build system for Fortran.

0 commit comments

Comments
 (0)