Howto:Build FlightGear with NetBeans using CMake: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 48: Line 48:
Only FG, SG and OSG should preferably be checked out from their corresponding repositories. Obviously, you could even use the latest stable OSG release, too (that is, if you don't intend to do any OSG and/or SimGear coding!).
Only FG, SG and OSG should preferably be checked out from their corresponding repositories. Obviously, you could even use the latest stable OSG release, too (that is, if you don't intend to do any OSG and/or SimGear coding!).


You can do this easily in NetBeans by going to the "Team" menu: [[File:Netbeans-checking-out-repositories.png]]
You can do this easily in NetBeans by going to the "Team" menu, this is where you can find sub menus for all supported source code management systems (CVS, Git, Mercurial and Subversion): [[File:Netbeans-checking-out-repositories.png]]


= Creating new projects from existing sources =
= Creating new projects from existing sources =

Revision as of 17:03, 19 October 2011

This article is a stub. You can help the wiki by expanding it.
  • Last updated: 10/2011
  • Author/s: Hooray
  • Status: WIP (as of 10/2011)

Important

The latest CMake-specific build instructions can be found in $FG_SRC/README.cmake: http://gitorious.org/fg/flightgear/blobs/next/README.cmake

If you encounter any CMake-related bugs while trying to build SimGear and/or FlightGear, please consider filing a bug report here: http://code.google.com/p/flightgear-bugs/issues/list

Download and install NetBeans 7.0.1

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, using the following steps, it took me about 30 minutes to set up a working FlightGear build environment in NetBeans, including the time required for the repository checkouts.

Go to http://netbeans.org/downloads/ in order to download the latest version of NetBeans for your OS/platform.

You can either choose the full download (~200 MB) or just the C/C++ bundle which is about 50 MB.

After downloading NetBeans, you'll need to install it.

Installing required modules (plugins)

Using the plugin installer, you need to install the following plugins in order to work with repositories:

  • cvs
  • svn (subversion)
  • git

In NetBeans, just go to the Tools menu and select "Plugins": Netbeans-getting-plugins.png

Checking out the required dependencies

All important FlightGear repositories are hosted at gitorious: http://gitorious.org/fg/

You will need to check out (git:"clone") the repositories for the following dependencies:

Note that it should usually be sufficient to download the latest RELEASE for Boost, OpenAL, and PLIB. Only FG, SG and OSG should preferably be checked out from their corresponding repositories. Obviously, you could even use the latest stable OSG release, too (that is, if you don't intend to do any OSG and/or SimGear coding!).

You can do this easily in NetBeans by going to the "Team" menu, this is where you can find sub menus for all supported source code management systems (CVS, Git, Mercurial and Subversion): Netbeans-checking-out-repositories.png

Creating new projects from existing sources

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-from-existing-sources-step1.png

Next, pick "...from existing sources": Netbeans-new-project-from-existing-sources-step2.png

Specify the folder where the checked out sources can be found: Netbeans-new-project-from-existing-sources-step3.png


For CMake-based projects, you'll want to point NetBeans to the CMakeLists.txt file instead of the configure script: Netbeans-new-project-from-existing-sources-step4.png

Finally, you should see all projects neatly structured in NetBeans:

Plib-osg-simgear-flightgear-in-netbeans.png

Next, you should set up project dependencies.

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):

Disable-code-assistance-in-netbeans.png

Setting up the Jenkins build server

Jenkins/Hudson are "continuous integration" servers, i.e. they can be configured to check out and build sources automatically. NetBeans comes with built-in support for Jenkins/Hudson, this means that the official FlightGear build server at http://flightgear.simpits.org:8080 can be directly integrated into your IDE.

This allows all people to easily track the build server, and allows core developers to trigger builds, too.

That's also pretty easy, just go to SERVICES and then right click on "Hudson Builders": Setting-up-jenkins-CI-in-netbeans-step1.png


Next, fill in the URL of the Jenkins CI server: Setting-up-jenkins-CI-in-netbeans-step2.png


Once completed, you should see this: Jenkins-integration-in-netbeans.png

Setting up remote development

Remote development involves setting up a SSH connection profile in NetBeans in order to connect to a Unix/Linux server so that you can remotely build FlightGear and its dependencies, this can for example be useful for cross-compilation, but also if you don't want to, or cannot, set up all required tools, such as compilers, locally.

Also, on Windows, this makes it possible to use a Linux sever for building, debugging and instrumenting/profiling FlightGear, while editing the source code on a Windows box. This means that you can use standard Linux tools such as gcov,gprof or valgrind while editing your code under Windows.

To get started, you should have an understanding of Linux and using SSH. In particular, you should know how to set up a SSH connection, including authentication (SSH keys). Obviously, for NetBeans it really doesn't matter if the Linux/Unix server is running in the same LAN or across the internet in the form of an affordable VPS box.

Once you have set up a new account to the corresponding Linux box, you only need to switch to the "Services" tab, go to "C/C++ Build Hosts", open a context menu and "add a new host": Netbeans-set-up-remote-building-step1.png

Next, add the address (or hostname), and the correct SSH port: Netbeans-set-up-remote-building-step2.png