Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto talk:Build FlightGear with NetBeans using CMake

From FlightGear wiki
Jump to: navigation, search

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.

Netbeans Installation Instructions

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.

Development Tools

  • git-core
  • subversion
  • automake
  • cmake
  • make
  • build-essential

Dependencies:

Base Package Dev Package Base Package Dev Package Base Package Dev Package
fluid libhal-dev libxi6 libxi-dev
gawk libjasper1 libjasper-dev libxinerama1 libxinerama-dev
gettext libopenal-dev libxmu6 libxmu-dev
libalut0 libalut-dev libopenexr-dev python-imaging-tk
libasound2 libasound2-dev libpng12-0 libpng12-dev python-tk
libboost-serialization-dv libboost-dev libqt4-dev scons
libfltk1.3 libsvn-dev zlib1g zlib1g-dev
libfltk1.3-dev libwxgtk2.8-0 libwxgtk2.8-dev
libglew1.5-dev libxft2 libxft-dev


on UBUNTU:

  • freeglut3-dev
  • libjpeg62-dev
  • libjpeg62
  • libapr1-dev
  • libfltk1.3-dev
  • libfltk1.3

On Debian:

  • freeglut3-dev
  • libjpeg8-dev
  • libjpeg8
  • libfltk-dev
  • libfltk1.1"

Flightgear Components and Dependencies

Flightgear has five main components, some with and some without dependencies.

Component Dependencies Description
plib None Portability Library
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
simgear
  • plib
  • OpenSceneGraph
  • openrti (optional and experimental)
simulation kernel
flightgear
  • plib
  • OpenSceneGraph
  • simgear
  • openrti (optional and experimental)
The flightgear application and several additional programs

There are a number of auxiliary programs avialable for flightgear. Some could be built under NetBeans.

Auxiliary Program Dependencies Description
fgcom
  • plib
  • OpenSceneGraph
  • simgear
FGCom is a command line, voip, virtual radio software built around Asterisk.
fgcomgui
  • plib
  • OpenSceneGraph
  • simgear
FGComGui is a simple gui front end to fgcom
fgrun
  • plib
  • OpenSceneGraph
  • simgear
FlightGear Launch Control (FGRun) is a graphical frontend for FlightGear
fgo
  • python
FGo! is a simple GUI front-end for FlightGear written in Python.
fgx
  • OpenSceneGraph
  • simgear
FGx is an Open Source graphical launcher application for FlightGear Flight Simulator that is built using Qt from Nokia
Atlas
  • OpenSceneGraph
  • simgear
  • fgdata
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:

  1. Get the sources
  2. Register, Build and Install
    1. Register a package as a NetBeans project
    2. Configure a package for Building
    3. Set Package Dependencies
    4. Build a package
    5. 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.

screenshots needed

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

  1. Clone the package repository with git or subversion
  2. Preparatory steps for packages that don't configure smoothly with Netbeans
  3. Create the package project under NetBeans
  4. Configure package in NetBeans
  5. Configure the package configuration file in NetBeans
  6. Run the Configuration
  7. Build
  8. Install

plib

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
projects/plib/configure properties:
Arguments --prefix=/opt/nb/fgfs/install CC=/usr/bin/gcc CXX=/usr/bin/g++ CFLAGS="-g3 -gdwarf-2" CXXFLAGS="-g3 -gdwarf-2" LDFLAGS=
Run Directory ../../build/plib
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:

 make install

Open Scene Graph

projects/OpenSceneGraph properties:
Property Name Property Value
Build/Make/Working Directory ../../build/OpenSceneGraph
projects/OpenSceneGraph/CMakeLists.txt properties:
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
Run Directory ../../build/OpenSceneGraph
CMake Command cmake
Environment

Simgear

Property Name Property Value
projects/simgear properties:
Build/Make/Working Directory ../../build/simgear
projects/simgear/CMakeLists.txt properties:
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
Run Directory ../../build/OpenSceneGraph
CMake Command cmake
Environment

Flightgear


Fgrun


Fggo


Fgcom


Atlas


Notes

Key Points about configuration in Netbeans 7.1:
configure The standard unix package configure command
  • configure is the build configuration script used by plib
  • configure must be created using aclocal.sh
  • In netbeans, the propties of configure provide arguments and environment variables for running the configure script
  • To build out of tree set the run Directory Property of the configure script file. For example: ../../build/plib
  • To install in desired location provide a value for --prefix= in the Arguments property of the configure script file for example: --prefix=/opt/nb/fgfs/install/plib
  • The configure script provides the makefiles needed to run the make command
  • The make command is run in NetBeans from a dropdown on the project folder
  • The make install command is run from the command prompt in the build directory
CMakeLists.txt used by OpenSceneGraph, simgear & flightgear
  • CMakeLists.txt is provided as of the project in git or subversion
  • In netbeans, the properties of CMakeLists.txt provide arguments and environment variables for running cmake
  • To build out of tree set the run Directory Property of the CMakeLists.txt file. For example: ../../build/OpenSceneGraph
  • To install in desired location provide a value for -D CMAKE_INSTALL_PREFIX:PATH="" in the Arguments property of the CMakeLists.txt cmake input file for example: -D CMAKE_INSTALL_PREFIX:PATH="../../install/OpenSceneGraph"
  • The cmake script provides the makefiles needed to run the make command
  • The make command is run in NetBeans from a dropdown on the project folder
  • The make install command is run from the command prompt in the build directory
  • OSG_DIR etc should not be set.


References and Notes:

  • Release vs. debug builds:. This is supported by cmake using a bunch of flags, just check the devel list archives: [[1]]
  • 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)

Old links

Thanks for updating those. I just noticed them myself this morning. Adam (talk) 12:19, 16 October 2015 (EDT)