Skip to content

Commit 2cf2d51

Browse files
committed
Simplify build/install instructions with CMake
1 parent 33c89d8 commit 2cf2d51

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

README.md

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
An example of implementing the
77
[Fortran bindings](https://github.com/csdms/bmi-fortran)
8-
for the CSDMS
9-
[Basic Model Interface](https://bmi-spec.readthedocs.io) (BMI).
10-
8+
for the CSDMS [Basic Model Interface](https://bmi.csdms.io) (BMI).
119

1210
## Overview
1311

@@ -50,22 +48,21 @@ This example can be built on Linux, macOS, and Windows.
5048

5149
### CMake - Linux and macOS
5250

53-
To build this example from source with CMake,
51+
To configure and build this example from source with CMake,
5452
using the current Fortran BMI version, run
5553

56-
mkdir _build && cd _build
57-
cmake .. -DCMAKE_INSTALL_PREFIX=<path-to-installation>
58-
make
54+
cmake -B _build -DCMAKE_INSTALL_PREFIX=<path-to-installation>
55+
cmake --build _build
5956

6057
where `<path-to-installation>` is the base directory
6158
in which the Fortran BMI bindings have been installed
6259
(`/usr/local` is the default).
6360
When installing into a conda environment,
6461
use the `$CONDA_PREFIX` environment variable.
6562

66-
Then, to install (on both Linux and macOS):
63+
Then, to install:
6764

68-
make install
65+
cmake --install _build
6966

7067
The installation will look like
7168
(on macOS, using v2.0 of the Fortran BMI specification):
@@ -81,8 +78,8 @@ The installation will look like
8178
| `-- heatf.mod
8279
`-- lib
8380
|-- libbmif.a
84-
|-- libbmif.2.0.2.dylib
85-
|-- libbmif.dylib -> libbmif.2.0.2.dylib
81+
|-- libbmif.2.1.4.dylib
82+
|-- libbmif.dylib -> libbmif.2.1.4.dylib
8683
|-- libbmiheatf.dylib
8784
|-- libheatf.dylib
8885
`-- pkgconfig
@@ -91,41 +88,36 @@ The installation will look like
9188
`-- heatf.pc
9289
```
9390

94-
From the build directory,
95-
run unit tests and examples of using the sample implementation with
91+
Run unit tests and examples of using the sample implementation with
9692

97-
ctest
93+
ctest --test-dir _build
9894

9995
### CMake - Windows
10096

10197
An additional prerequisite is needed for Windows:
10298

10399
* Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017
104100

105-
To configure this example from source with cmake
101+
To configure and build this example from source with CMake
106102
using the current Fortran BMI version,
107103
run the following in a [Developer Command Prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)
108104

109-
mkdir _build && cd _build
110-
cmake .. ^
111-
-G "NMake Makefiles" ^
112-
-DCMAKE_INSTALL_PREFIX=<path-to-installation> ^
113-
-DCMAKE_BUILD_TYPE=Release
105+
cmake -B _build -L -G Ninja -DCMAKE_INSTALL_PREFIX=<path-to-installation>
106+
cmake --build _build
114107

115108
where `<path-to-installation>` is the base directory
116109
in which the Fortran BMI bindings have been installed.
117110
The default is `"C:\Program Files (x86)"`.
118111
Note that quotes and an absolute path are needed.
119112
When using a conda environment, use `"%CONDA_PREFIX%\Library"`.
120113

121-
Then, to build and install:
114+
Then, to install:
122115

123-
cmake --build . --target install --config Release
116+
cmake --install _build
124117

125-
From the build directory,
126-
run unit tests and examples of using the sample implementation with
118+
Run unit tests and examples of using the sample implementation with
127119

128-
ctest
120+
ctest --test-dir _build
129121

130122

131123
### Fortran Package Manager (fpm)

0 commit comments

Comments
 (0)