Howto talk:Build FlightGear with NetBeans using CMake
Macnab's edits in 12/2012
Hi there, just looking through your latest changes. And I noticed that you are now making the assumption that the article is solely about Windows ? Previously it was fairly agnostic actually and explicitly highlighted the differences between Windows/Linux - while this may now be easier for Windows users, I'm not sure about people on different platforms ... so what is your plan here ? --Hooray 07:08, 16 December 2012 (EST)
Did it without thinking. I'll replace the Windows: bit, and add it to the section on getting CMake. And also make a note if I see anything that is Windows specific.Macnab 07:19, 16 December 2012 (EST)
Updating Build FlightGear with NetBeans using CMake - Proposed Sections
Downloading and Installing Netbeans
NetBeans is a multi-platform IDE or Integrated Development Environment. It supports several programming languages, C and C++ among them.
You can find netbeans for your platform at http://netbeans.org/downloads/ You can either choose the full suite (~200 MB) or just the C/C++ bundle which is about 50 MB.
Build Tools and Flightgear Package Dependencies
There are a number of tools used to build and dependent packages needed for FlightGear. These do not need to be set up in NetBeans, but do need to be installed.
|Base Package||Dev Package||Base Package||Dev Package||Base Package||Dev Package|
Flightgear Components and Dependencies
Flightgear has five main components, some with and some without dependencies.
|OpenSceneGraph (osg)||None||High Performance 3D Graphics Toolkit|
|openrti||None? may have additional package dependencies||HLA/RTI implementation providing HLA1.3, IEEE-1516 and IEEE-1516E interfaces|
||The flightgear application and several additional programs|
There are a number of auxiliary programs avialable for flightgear. Some could be built under NetBeans.
||FGCom is a command line, voip, virtual radio software built around Asterisk.|
||FGComGui is a simple gui front end to fgcom|
||FlightGear Launch Control (FGRun) is a graphical frontend for FlightGear|
||FGo! is a simple GUI front-end for FlightGear written in Python.|
||FGx is an Open Source graphical launcher application for FlightGear Flight Simulator that is built using Qt from Nokia|
||The Atlas program lets FlightGear users display a real-time "moving-map" of their flight.|
Building Flightgear under NetBeans C/C++ project
The packages must be handled one at a time, but the basic steps for each is the same:
- Get the sources
- Register, Build and Install
- Register a package as a NetBeans project
- Configure a package for Building
- Set Package Dependencies
- Build a package
- Install a package
Each dependent package must be downloaded, cloned or checked out from a source repository. There are three types of source repository in use: CVS, Subversion and Git. We'll give you specific commands and NetBeans configuration entries to copy the sources to your build environment. We'll even provide a script to do them all at once.
A note about configuring the packages: Not all of the dependent projects use CMake. Some use aclocal.sh and configure, some just configure, We'll show you how to set up each dependency for building using the correct configuration method.
Suggested Directories or Folders
You can build flightgear with or without debugging information. We recommend you use separate accounts to isolate the various types of builds you may want to do. If you wish to build for multiple platforms, or wish to isolate your work on flightgear to an environment that has only what is required to build Flightgear, we suggest using a VM such as VirtualBox
Flightgear's fgdata is a large. fgdata is versioned and when running flightgear you must use the corresponding version of fgdata. You may need an fgdata for each version of Flightgear you wish to build and work with.
If you have already installed a version from your distribution, you can re-use the fgdata from that installation for your own build of the same version. To avoid multiple downloads of fgdata download it once and use a symbolic link in separate builds.
autogen.sh in NetBeans Projects
After downloading plib in NetBeans, it must be configured at the command prompt.
Make the plib sources directory the current directory and run autogen.sh .
autogen.sh produces a configure script, usable from within NetBeans.
configure in NetBeans Projects
Configure is a standard step in the build process.
In NetBeans, set the NetBeans configure script propterty to the configure file. Then within the NetBeans IDE right click the configure item and select run. This completes the configuration step for the package. You can also run or rerun configure by selecting the project, right clicking and selecting Code Assistance -> Reconfigure Project from the pop-up menu.
Screen Shots needed.
Detailed instructions for Linux
Get Prerequisite Packages
As listed above under Flightgear Components and Dependencies there are a number of tools and flightgear dependencies. The easiest way to get them for Ubuntu or Debian is to use the download_and_compile.sh script. This will be all we'll use it for. Downloading and compiling the components will be done under NetBeans.
mkdir temp cd temp wget -c http://www.gitorious.org/fg/fgmeta/blobs/raw/master/download_and_compile.sh chmod +x download_and_compile.sh ./download_and_compile.sh PackagesOnly # enter your password when prompted cd ../ rm -rf temp
Overview of Steps for each flightgear component package
- Clone the package repository with git or subversion
- Preparatory steps for packages that don't configure smoothly with Netbeans
- Create the package project under NetBeans
- Configure package in NetBeans
- Configure the package configuration file in NetBeans
- Run the Configuration
After cloning plib, run aclocal.sh at the command prompt to create the configure script:
$cd $NETBEANS_FGFS # for me this is /opt/nb/fgfs $cd projects/plib $./aclocal.sh # This creates configure at the top level of the plib project
Once configure is created, you can set properties to be used when running configure from within netbeans:
In netbeans, select the configure file, right click and select properties. set the entries as follows:
|Property Name||Property Value|
|Arguments||--prefix=/opt/nb/fgfs/install CC=/usr/bin/gcc CXX=/usr/bin/g++ CFLAGS="-g3 -gdwarf-2" CXXFLAGS="-g3 -gdwarf-2" LDFLAGS=|
|Environment||CC=/usr/bin/gcc CXX=/usr/bin/g++ CFLAGS="-g3 -gdwarf-2" CXXFLAGS="-g3 -gdwarf-2" LDFLAGS=|
select the plib project in NetBeans right click and select "Code Assistance" and "Reconfigure Project" You can also select the configure script, right click and select Run If you can't get configure to work properly the first time in Netbeans, at the command prompt: $cd ../../build/plib $../../projects/plib/configure
Build plib from within Netbeans:
Select the plib project in Netbeans Right Click and select "Build"
Install plib from the command prompt:
Open Scene Graph
|Property Name||Property Value|
|Arguments||-D CMAKE_BUILD_TYPE="Debug" -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="/opt/nb/fgfs/install" ../../install|
|Property Name||Property Value|
|Arguments||-D CMAKE_PREFIX_PATH:PATH="/opt/nb/fgfs/install/OpenSceneGraph" -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="../../install/simgear" /opt/nb/fgfs/projects/simgear|
|Key Points about configuration in Netbeans 7.1:|
|configure||The standard unix package configure command
|CMakeLists.txt||used by OpenSceneGraph, simgear & flightgear
References and Notes:
- Release vs. debug builds:. This is supported by cmake using a bunch of flags, just check the devel list archives: []
- Cross platform builds: (i.e. Linux host for Win target) will only work with a cross compiler and all required headers and libs. MingW is probably your best bet here (for Windows targets). The simplest (and cleanest) cross-compiling option may be installing a fresh linux distro in a VM and then downloading the official mingw compiler via the package manager so that the VM only supports cross-platform builds, that's also the type of setup used by the jenkins build server. Basically, each VM is absolutely self contained so that you can be 100% certain that there are no dependency conflicts.
- Setting up different users for each type of build: is by far the easiest option to set up things, because then you don't have to install stuff system-wide stuff, also there's not the slightest chance to mess up your system or the compiler picking up dependencies for the wrong target. Basically, it's all about encapsulation ;-)
- System Wide Installs: If you want things to be installed "easily" (i.e. system-wide), using separate VMs for each build will probably be easier, i.e. separate VMs for each build target.
- The Virtual Appliance Idea: Given the complexity involved of getting this right, Horray has been thinking about simplifying this whole thing even further: "The "easiest" route that I could come up with is creating complete IDE setup (NetBeans) and then bundling the whole thing as a virtual appliance. We've been talking about this several times already. This should be possible using VMWare or VirtualBox. Basically, we would set up everything as required in a VM (i.e. NetBeans, libs, compiler, dev tools like gprof etc) and then "remaster" the distribution so that a live CD/DVD or bootable USB stick image can be created. Using www.susestudio.com this would not be too complicated, and it can even be done remotely by using a VNC session. The advantage would be that people would merely have to download a "virtual appliance" which they could directly run on all OS (Windows, MacOS and Linux). By using a DVD, we could even include a checkout/bundle of FGDATA, too. --Hooray 13:47, 17 March 2012 (EDT)