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
Copy file name to clipboardExpand all lines: doc/DevelopersDocs.md
+39-21Lines changed: 39 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,21 +32,21 @@ JSBSim is coded in standard C++17 and has no dependencies, so all you need is a
32
32
33
33
### Building with CMake
34
34
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.
36
36
37
37
```bash
38
38
>cd jsbsim-code
39
39
> mkdir build
40
40
>cd build
41
41
```
42
42
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.
44
44
45
-
First, you should invoke CMake and then execute `make`
45
+
First, you should invoke CMake and then execute the build:
46
46
47
47
```bash
48
48
> cmake ..
49
-
>make
49
+
>cmake --build .
50
50
```
51
51
52
52
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
@@ -77,7 +77,7 @@ JSBSim uses the [Expat library](https://libexpat.github.io/) to read XML files.
77
77
78
78
```bash
79
79
> cmake -DSYSTEM_EXPAT=ON ..
80
-
>make
80
+
>cmake --build .
81
81
```
82
82
83
83
##### Building shared libraries
@@ -87,7 +87,7 @@ The option `BUILD_SHARED_LIBS` must then be passed to CMake
87
87
88
88
```bash
89
89
> cmake -DBUILD_SHARED_LIBS=ON ..
90
-
>make
90
+
>cmake --build .
91
91
```
92
92
93
93
#### Building the Python module of JSBSim
@@ -126,33 +126,45 @@ A code coverage report is automatically generated and is available at: <https://
126
126
127
127
## Installing JSBSim
128
128
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:
130
136
131
137
```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:
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.
136
148
137
149
```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
141
153
```
142
154
143
155
### Installing the Python module
144
156
145
157
#### Installation with CMake
146
158
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.
148
160
149
161
```bash
150
162
> cmake -DINSTALL_JSBSIM_PYTHON_MODULE=ON ..
151
-
>make
152
-
>make install
163
+
>cmake --build .
164
+
>cmake --install. --component pymodules
153
165
```
154
166
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.
156
168
157
169
#### Installation of the Python module
158
170
@@ -186,7 +198,7 @@ The packaging can be done by passing the option `CPACK_GENERATOR` to CMake then
186
198
187
199
```bash
188
200
> cmake -DCPACK_GENERATOR=DEB .. # or RPM
189
-
>make
201
+
>cmake --build .
190
202
> cpack
191
203
```
192
204
@@ -205,7 +217,7 @@ The JSBSim C++ API documentation is built from the source code with [Doxygen](ht
205
217
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
206
218
207
219
```bash
208
-
>make doc
220
+
>cmake --build . --target doc
209
221
```
210
222
211
223
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
250
262
251
263
### When I try to run `ctest`, most of the tests fail
252
264
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
254
266
255
267
```text
256
268
31: Traceback (most recent call last):
@@ -276,3 +288,9 @@ To avoid prepending every `ctest` command with `LD_LIBRARY_PATH=$PWD/src` you ca
276
288
```
277
289
278
290
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