Howto:Build FlightGear with NetBeans using CMake

From FlightGear wiki
Jump to navigation Jump to search


The latest CMake-specific build instructions can be found in $FG_SRC/README.cmake: flightgear/README.cmake. If you encounter any CMake-related bugs while trying to build SimGear and/or FlightGear, please consider filing a bug report here: Issue tracker tickets. If you think the instructions are lacking some details, you are invited to add them as required. Also, if you think that some more specific screen shots would help, please do feel free to upload new screen shots here: Special:UploadWizard. Don't worry if you don't know how to embed these images, you can simply leave a comment on the article's talk page, so that we can update the article accordingly. Thanks!

Download and install NetBeans

NetBeans is a multi-platform IDE (integrated development environment) that supports a number of programming languages, C and C++ among them. NetBeans is a highly modular and very powerful IDE with a huge range of features. Go to in order to download the latest version of NetBeans for your OS/platform. After downloading NetBeans, you'll need to install it.

Note  According to the latest release notes release notes 12.0 the C++ plugin is not ported to the new Apache infrastructure. You have to enable Netbeans 8.2 plugin center and install C/C++ plugin from it. It will be available in the future releases in the NetBeans core.

Linux: getting & compiling

Please take a look at generic page: Building_FlightGear or Building on Linux using the bash script

Windows: getting & compiling

Please take a look at the generic page regarding Windows compilation: Building using CMake - Windows

Folder Structure

You need separate folders in which the project build outputs will be created. If you download and create folders according to the build environment in Windows/Linux OS there is nothing new.

Netbeans project import

After checking out the repository, you'll want to use the NetBeans project wizard to CREATE A NEW PROJECT FROM EXISTING SOURCES for each dependency:

NetBeans New Project.png

Next, pick "...from existing sources":

NetBeans New Project Existing.png

Specify the folder where the checked out sources can be found:

NetBeans New Project Automatic.png

Click Finish. NetBeans will attempt to build the project, which will fail, as no dependencies have been set. Ignore it, the project will still be set-up. Repeat above steps for the simgear code. Finally, you should see all projects neatly structured in NetBeans:

NetBeans project listing

Disable code indexing

By default, NetBeans will keep on trying and index all your sources, this may slow down the IDE considerably, so it's a good idea to disable this feature if you don't need it (CONTEXT MENU/RIGHT CLICK on project, go to CODE ASSISTANCE and then uncheck the marked entry):

NetBeans Code Assistance.png

Debugging using Gdb/Netbeans as a IDE

Examplary configuration for easy debugging FlightGear source code inside IDE using GDB as a backend can be configured in various ways. This screens shows how to configure two projects 'simgear' and 'flightgear' to compile with the debug flags inside the IDE and be able to execute it or debug directly inside IDE. This is a great way to extend FlightGear and help fixing bugs for people not very experienced with the GDB commandline interface. It has all features of the debug inside IDE as graphical watches, breakpoints etc.

Note  Following settings are set according to one user directory structure and his compile/debug options. Please refer to the latest compile/debug options in SimGear/FlightGear in order to set them correctly.

In order to configure it, this settings has to be set in one user environment in order to successfully compile it and debug.

  • Simgear

SimGear source configuration

NetBeans config - simgear source configuration

Simgear prebuild (CMAKE) options

NetBeans config - simgear prebuild (CMAKE) options

Simgear build options

NetBeans config - simgear build options

Simgear compile options

NetBeans config - simgear compile options

Simgear make options

NetBeans config - simgear make options

  • FlightGear

FlightGear source configuration

NetBeans config - flightgear source configuration

FlightGear prebuild (CMAKE) options

NetBeans config - flightgear prebuild (CMAKE) options

FlightGear build options

NetBeans config - flightgear build options

FlightGear make options

NetBeans config - flightgear make options

FlightGear compile options

NetBeans config - flightgear compile options

And setting regarding debug and run sessions:

FlightGear debug options

NetBeans config - flightgear debug options

FlightGear run options

NetBeans config - flightgear run options

After this settings one can run/debug FlightGear source code inside the IDE :)