Developing on the codebase#
The easiest way to work on the codebase is using the superbuild CMakeList.txt checked into fgmeta. If you are already familiar with CMake
superbuilds, you can simply open the fgmeta as a workspace in your favourite smart editor (eg, Visual Studio Code), customize CMakeUserPresets.json to submit
your local setup, and code, build and debug as normal. The steps below explain this process in more detail.
Clone
fgmeta, thengit submodule init fgdata flightgear simgear. If you’re on Windows, alsogit submodule init windows-3rd-party. We’re explicitly listing the submodules here since some submodules don’t make sense for most people, and clutter up the build folder.Update the submodules; this takes some time since initial cloning of
FGDatais slow:git submodule update --remoteClone our forked OpenSceneGraph from
https://gitlab.com/flightgear/openscenegraph(pick a location outsidefgmeta)Build OpenSceneGraph and install into a suitable local prefix outside
fgmeta; for example specify~/FGFS/osg-buildas the build directory and~/FGFS/osg-distas theCMAKE_INSTALL_PREFIX. (Again make sure you don’t use the system install prefix of/usrfor installation, that will cause problems or overwrite your distro OpenSceneGraph)Open the
fgmetadirectory as a workspace in your favourite C++ IDE : VS Code, CLion, etc.Copy
CMakeUserPreset-example.jsontoCMakeUserPresets.jsonand modify to suit. Notably, you should setCMAKE_PREFIX_PATHto include the prefix you used for OpenSceneGraph. You will probably also need to include the path to your Qt installation, if you want to use the launcher, but this is optional and often not needed for development work.
on macOS, you are recommended to download the most recent
macos-3rd-partyarchive from GitLab, eg from:https://gitlab.com/flightgear/macos-3rd-party/-/artifacts: pass the location of the extracted files toCMAKE_PREFIX_PATHalongside any other paths. This is the easiest way to get the dependencies which are not available viaHomebrew, such as PLIB and OpenAL-soft.
Modern IDEs will detect updates to the CMake presets file and re-run the CMake configuration step, e.g., if you have installed the VS Code CMake integration plugin.
Build the code: the super-build will build both SimGear and FlightGear
Day-to-day development#
code-indexing should work across both SimGear and FlightGear
no need to run any installation steps, the super-build handles dependencies correctly, eg if you edit a SimGear file the correct FlightGear pieces will rebuild
set breakpoints in the code as needed
update the
flightgearandsimgearmodules as needed : note thatfgmeta’s next branch does not receive commits to track the submodules, we assume developers track the HEAD ofnextforsimgearandflightgearrepositories.create e.g.,
launch.jsonentries as needed (if using VS Code) to facilitate debugging
Invoking CMake manually#
If you use an editor that doesn’t detect CMake projects automatically, you can manually invoke CMake to create the build, and use cmake --build to build.
For example: cmake -S fgmeta -B build-fgmeta --preset MyPreset (assuming you named your preset MyPreset, of course)