Skip to content

Commit b5aae4f

Browse files
authored
Remove references to make and use CMake for all tasks. (#1449)
1 parent 9bd0e18 commit b5aae4f

1 file changed

Lines changed: 39 additions & 21 deletions

File tree

doc/DevelopersDocs.md

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ JSBSim is coded in standard C++17 and has no dependencies, so all you need is a
3232

3333
### Building with CMake
3434

35-
CMake is a multiplatform tool to build and test software. It can produce files to build JSBSim with GNU make or Microsoft Visual Studio. To keep the build files separated from the source code, it is preferable to build JSBSim in a separate directory.
35+
CMake is a multiplatform tool to build and test software. It can produce files to build JSBSim with a wide variety of tools (GNU make, Microsoft Visual Studio, Ninja, etc.). To keep the build files separated from the source code, it is preferable to build JSBSim in a separate directory.
3636

3737
```bash
3838
> cd jsbsim-code
3939
> mkdir build
4040
> cd build
4141
```
4242

43-
CMake *does not build* software, it produces files *for* a multitude of build tools. The following commands are assuming that you are using GNU make to build JSBSim.
43+
The following commands are assuming that you are using the command line to build JSBSim.
4444

45-
First, you should invoke CMake and then execute `make`
45+
First, you should invoke CMake and then execute the build:
4646

4747
```bash
4848
> cmake ..
49-
> make
49+
> cmake --build .
5050
```
5151

5252
This will compile the various classes, and build the JSBSim application which will be located in `build/src`
@@ -61,14 +61,14 @@ If you want to set compiler options, you can pass flags to CMake to build a `Deb
6161

6262
```bash
6363
> cmake -DCMAKE_CXX_FLAGS_DEBUG="-g -Wall" -DCMAKE_C_FLAGS_DEBUG="-g -Wall" -DCMAKE_BUILD_TYPE=Debug ..
64-
> make
64+
> cmake --build .
6565
```
6666

67-
Or alternatively you can build a `Release` version of JSBSim and request GNU Make to use 4 cores to build the executable faster.
67+
Or alternatively you can build a `Release` version of JSBSim and request CMake to use 4 cores to build the executable faster.
6868

6969
```bash
7070
> cmake -DCMAKE_CXX_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_C_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_BUILD_TYPE=Release ..
71-
> make -j4
71+
> cmake --build . -j4
7272
```
7373

7474
##### Building Expat or using the system library
@@ -77,7 +77,7 @@ JSBSim uses the [Expat library](https://libexpat.github.io/) to read XML files.
7777

7878
```bash
7979
> cmake -DSYSTEM_EXPAT=ON ..
80-
> make
80+
> cmake --build .
8181
```
8282

8383
##### Building shared libraries
@@ -87,7 +87,7 @@ The option `BUILD_SHARED_LIBS` must then be passed to CMake
8787

8888
```bash
8989
> cmake -DBUILD_SHARED_LIBS=ON ..
90-
> make
90+
> cmake --build .
9191
```
9292

9393
#### Building the Python module of JSBSim
@@ -126,33 +126,45 @@ A code coverage report is automatically generated and is available at: <https://
126126

127127
## Installing JSBSim
128128

129-
Once JSBSim is built and tested, you can install the C++ headers and library. For that, you can invoke GNU make from the `build` directory
129+
Once JSBSim is built and tested, you can install it. It is now recommended to use `cmake --install` instead of `make install`. This allows you to install specific components of JSBSim:
130+
131+
- `runtime`: To install the `JSBSim` executable (`JSBSim.exe` on Windows).
132+
- `devel`: To install the C++ headers and library.
133+
- `pymodules`: To install the Python module.
134+
135+
For instance, to install the headers and the library, you can invoke the following command from the `build` directory:
130136

131137
```bash
132-
> make install
138+
> cmake --install . --component devel
139+
```
140+
141+
Several components can be installed at once by repeating the `--component` option. For instance, to install the `JSBSim` executable and the Python module, you can invoke the following command from the `build` directory:
142+
143+
```bash
144+
> cmake --install . --component runtime --component pymodules
133145
```
134146

135147
By default, CMake copies the files to a location where the headers and library are available platform wide (typically `/usr/include`, `/usr/lib` or `/usr/local/include`, `/usr/local/lib` for *nix OSes). If you want to install the files in another location you can pass the flag `CMAKE_INSTALL_PREFIX` to cmake.
136148

137149
```bash
138-
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
139-
make
140-
make install
150+
> cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
151+
> cmake --build .
152+
> cmake --install . --component devel
141153
```
142154

143155
### Installing the Python module
144156

145157
#### Installation with CMake
146158

147-
If you plan to install the Python module of JSBSim in addition to the C++ headers and library, then you must pass the flag `INSTALL_JSBSIM_PYTHON_MODULE` to CMake. This is the procedure you should follow if you plan to package JSBSim with CPack.
159+
If you plan to install the Python module of JSBSim, then you must pass the flag `INSTALL_JSBSIM_PYTHON_MODULE` to CMake. This is the procedure you should follow if you plan to package JSBSim with CPack.
148160

149161
```bash
150162
> cmake -DINSTALL_JSBSIM_PYTHON_MODULE=ON ..
151-
> make
152-
> make install
163+
> cmake --build .
164+
> cmake --install . --component pymodules
153165
```
154166

155-
**Note:** `make install` will attempt to override [Python virtual environments](https://docs.python.org/3/tutorial/venv.html) in order to install the Python module platform wide (i.e. in a directory such as `/usr/lib/python`). If you want the Python module installation process to comply with your virtual environment, you should use the Python `distutils` as described below.
167+
**Note:** `cmake --install` will attempt to override [Python virtual environments](https://docs.python.org/3/tutorial/venv.html) in order to install the Python module platform wide (i.e. in a directory such as `/usr/lib/python`). If you want the Python module installation process to comply with your virtual environment, you should use the `pip` installation as described below.
156168

157169
#### Installation of the Python module
158170

@@ -186,7 +198,7 @@ The packaging can be done by passing the option `CPACK_GENERATOR` to CMake then
186198

187199
```bash
188200
> cmake -DCPACK_GENERATOR=DEB .. # or RPM
189-
> make
201+
> cmake --build .
190202
> cpack
191203
```
192204

@@ -205,7 +217,7 @@ The JSBSim C++ API documentation is built from the source code with [Doxygen](ht
205217
If you modify the documentation, you might need to generate the documentation locally in which case you should run the following command after `cmake` has been executed
206218

207219
```bash
208-
> make doc
220+
> cmake --build . --target doc
209221
```
210222

211223
The HTML documentation will then be available in the directory `build/documentation/html`. Note that you need [Doxygen](www.doxygen.org) and [Graphviz](www.graphviz.org) to be installed.
@@ -250,7 +262,7 @@ You can find more informations about `ctest` from its [manual page](https://cmak
250262

251263
### When I try to run `ctest`, most of the tests fail
252264

253-
**Q:** Before running `make install`, I want to execute `ctest` but most of the tests fail. And when I check in the file `Testing/Temporary/LastTestsFailed.log` it reports many Python `ImportError` such as
265+
**Q:** Before installing JSBSim, I want to execute `ctest` but most of the tests fail. And when I check in the file `Testing/Temporary/LastTestsFailed.log` it reports many Python `ImportError` such as
254266

255267
```text
256268
31: Traceback (most recent call last):
@@ -276,3 +288,9 @@ To avoid prepending every `ctest` command with `LD_LIBRARY_PATH=$PWD/src` you ca
276288
```
277289

278290
Please note that as soon as your shell session will be terminated, the modification to `LD_LIBRARY_PATH` will be lost.
291+
292+
### When I try to run `make install`, I get errors about missing files
293+
294+
**Q:** I am trying to install JSBSim using `make install` but I encounter errors stating that some files cannot be found.
295+
296+
**A:** The use of `make install` is no longer supported for installing JSBSim. You should instead use `cmake` as described in the [Installing JSBSim](#installing-jsbsim) section above. This new method allows for a more granular installation by selecting specific components (such as `runtime`, `devel`, or `pymodules`).

0 commit comments

Comments
 (0)