Seven steps: 1. CMake 2. Sources 3. Work Folder 4. Build OSG 5. Build FG 6. OpenAL 7. Run FG - End

Update: 16 September, 2008: This is my second build in Vista, using MSVC9 - see fgfs-045.htm - OpenAL is now installed using the OpenAL SDK, and only ALUT is built in this process, and must be installed with its friends OpenAL32.DLL, and wrap_oal.dll, in the %SYSTEMROOT%\System32 directory. This changed the folder structure a little ... also libpng was updated. The [nn] of this latest is [02] ...

Update: 9 March, 2008: This file, README.fgfs.htm, is include in the solution zip file, and is repeated online, where the graphics will be shown ... There is also a brief README.fgfs.txt in the fgfs folder when vc8sln[nn].zip is unpacked. Note the [nn] used was '08' at that time!

An attempt has been made to create a SINGLE SOLUTION FILE to build FlightGear, HOWEVER OSG already has it own 'single solution' using CMake, so it has been left separate. So now I have a  TWO SOLUTION SYSTEM (TSS). With the recent use of PNG graphic files in FlightGear, it nearly became a THREE solution system, but by running fgfs/fgfs.sln twice, first and last, it has been kept to TWO ;=))

1. CMake

Download, and install CMake - -

For the Windows platform, they have it in a Win32 Installer EXE. The first install option asks whether to add CMake to the system path. CMake has a GUI front end, so this is not required, unless you intend running CMake from the command line.

This adds an All Programs -> CMake 2.4 (or later) -> Cmake application, ready for use when you have all the sources in place. Note the building of osgdb-png.dll (& osgdb-zip.dll), now required by FG, has prerequisites of libpng, and zlib ... these two static libraries must be built before building OSG ... but first to the source ...



Download, or update ALL the SOURCES - FlightGear (source and data), SimGear, freeglut, ALUT and OpenAL, PLIB, zlib, pthreads, OpenSceneGraph, and now libpng. pthreads is optional, but needed if you do not want to change the current build system. Likewise, there are alternatives to freeglut.

Where possible I use the latest CVS (or SVN) development versions. I download all the following into a root folder C:\FGCVS ... Hereafter I shall call this the <update> folder.

a. FlightGear - This includes FlightGear source and data (base package).
 CVS -


 b. Prerequisites - in no particular order - they are ALL important, with the exception of pthreads, which is optional, but recommended. Note, although valid at this time, some of the links may become 'stale', over time ...

-- Glut (FreeGlut) - OpenGL Utility Toolkit (GLUT) library -
 CVS -
 Folder: <update>\freeglut\freeglut (note the double level!)
-- OpenAL - Cross Platform 3D Audio. -
 SDK - -for OpenAL and ZIP for ALUT
 Folder: <update>\freealut-1.1.0-src (for alut only)
-- PLIB - portability libraries. -
 SVN -
 Folder: <update>\PLIB
-- SimGear - simulation construction tools -
 CVS -
 Folder: <update>\Simgear
-- Zlib - A Massively Spiffy Yet Delicately Unobtrusive Compression Library.
 tar.gz -
 Folder: <update>\zlib-1.2.3
-- pthreads - POSIX Threads for Win32 - (optional)
 CVS -
 Folder: <update>\pthreads
-- OpenSceneGraph (OSG) - 3D graphics toolkit, and dependencies
 SVN - -> Downloads -> Subversion Repository
 Folder: <update>\OpenSceneGraph
-- libpng (PNG) - Portable Network Graphics (uses zlib compression) - -> download lpng<vers>.zip, and/or other source tar balls, and unzip into the lpng<ver> folder ...
 Folder: <update>\lpng<ver>


This is a repeat of the list, as it appears in my SETUPFG.BAT batch file -
@REM This may need to be CHANGED to suit your download/update root folder.
@if NOT EXIST %TEMP2%\FlightGear\source\. goto ERR3
@if NOT EXIST %TEMP2%\freeglut\freeglut\. goto ERR4
@if NOT EXIST %TEMP2%\freealut-1.1.0-src\. goto ERR5
@if NOT EXIST %TEMP2%\OpenSceneGraph\. goto ERR6
@if NOT EXIST %TEMP2%\PLIB\. goto ERR8
@if NOT EXIST %TEMP2%\pthreads\. goto ERR10
@if NOT EXIST %TEMP2%\SimGear\. goto ERR11
@if NOT EXIST %TEMP2%\zlib-1.2.3\. goto ERR12
@if NOT EXIST %TEMP2%\lpng1231\. goto ERR13
@if NOT EXIST %TEMP2%\FlightGear\data\. goto ERR2

This is a view of my source / downloaded / update folders ...

Current - 20080915 Previous
folders as of Sep 15, 2008 View of source (CVS/SVN updated or downloaded/unzipped) folders.

The only OPTIONAL item is 'pthreads'. This can be excluded from the simgear and flightgear projects. OpenAL is now downloaded in an SDK form. freeglut can be replaced with the original GLUT (OpenGL) - - or Simple Direct Media Layer (SDL) - -but I have not tried these ...


3. Setup a WORK folder.

I NEVER build directly using the above <update> folder. This is so I can update any or all the sources, and compare what has changed with my <work> folders, using various tools, like GNU diff ( ) or my own Directory Compare ( ), before doing a <work> update. Remember, CVS/SVN are DEVELOPMENT streams, and there is a chance that FG will not work at that precise moment.

I use the above SETUPFG.BAT batch file, to XCOPY each of the sources to a NEW <build> folder it will create. Of course, this batch can ONLY be used, if you place the source in the folders enumerated. Running SETUPFG.BAT without a command will check if ALL the sources can be found.

Another possible problem with cvs/svn sources, in that they are the latest in development, thus on any given day, the cvs/svn sources may not compile and link using my SOLUTION FILE with MSVC9 ... This becomes more and more so over time.

When the batch file has done it work, you should have the following folders in the <work>/<build> folder :- bin, data (optional), fgfs, FlightGear, freeglut, lpng1231, alut, OpenSceneGraph, PLIB, pthreads, SimGear, and zlib-1.2.3. This is a view of my WORK folders -

Current - 20080915 Previous
Current work folder image View of my WORK folder, after SETUPFG batch has run ...


4. Building OSG

Due to the fact that FG now uses PNG graphic files, which uses ZLIB compression, to enable the build of osgdb-png.dll and osgdb-zip.dll plugins, the static libraries libpng.lib (& libpngd.lib), and zlib.lib (& zlibd.lib) MUST be built BEFORE running CMake on the OSG source. This means Step 5. below must be commenced, and although the final link of FlightGear will FAIL due to no OSG libraries, the PNG and ZLIB static libraries will be built. So, proceed to Step 5. first, and then return to here ...

(a) Start the CMake application, and drag and drop the CmakeLists.txt from <work>\<build>\OpenSceneGaph into the frame. Select your build tool, in this case MSVC9. This should establish the OSG source and build folders.
(b) Click [ Configure ]. Some adjustments may have to be made, and click [ Configure ] again, until the [ Ok ] button is un-grayed, then click [ Ok ]. This should build the MSVC9 OSG solution set.
(c) Load OpenSceneGraph.sln into MSVC9, and build at least the Release configuration. If you want to do some Debug, then select Debug configuration and build. This process should build over 100 DLL (shared libraries), together with their respective LIB components for a link.

Later there is an upd.bat to copy all the required DLL (shared libraries) to the bin folder, from where FlightGear.exe will be run ... Note, this placing of the DLLs in the SAME folder as the runtime EXE replaces any other method for installing a DLL ...


5. Building FlightGear

Unzip the vc9sln[nn].zip into your <work>\<build> folder. Allow it to overwrite existing solution files. And this should add a srccfg[nn].zip to your <build> folder. Likewise, unzip this 'configuration' zip.

There may also be a srcchg[nn].zip, if I needed to change any files during the build. This presently is none, but it can be become necessary. Even if present, you should TRY a build without unzipping this, as it may have been fixed meantime.

You are now ready to load <work>\<build>\fgfs\fgfs.sln into MSVC, and proceed to build, first all the other prerequisites of FlightGear, then eventually FlightGear itself. You can build just the Release, or both configurations.


6. OpenAL - Sound library DLLs

If you have not previously installed OpenAL, download an install the OpenAL SDK, and run the oalinst.exe to copy OpenAL32.dll and wrap_oal.dll to %SYSTEMROOT%\System32. And when FG build is completed on alut.dll, it must be copied to the same place. In Vista this requires administrator privileges. None of this is now done by my UPD.BAT!

Also note these may conflict with any cygwin OpenAL DLLs installed, when trying to run FG under cygwin. To work with cygwin these 3 files may need to be deleted!


7. Running FlightGear

First, some things have to be, sort of, installed. Usually 'installed' means something more, but here all we are doing is making a folder where FlightGear.EXE can run. It needs access to several DLL (shared libraries), and I have an UPD.BAT (<work>\<build>\upd.bat) batch file to do this.

This batch file will copy Release\FlightGear.EXE to the <work>\<build>\bin folder, and then copy all the necessary DLL (shared libraries) into that same folder. The <work>\<build>\Upd.bat can also take one command, 'D', to also copy the Debug configuration as well as the Release configuration, if built ...



Change into the <work>\<build>\bin folder, and enter :-
---> FlightGear --fg-root=..\data
Of course this is only true, if you allowed SETUPFG.BAT to ALSO copy the 'data' ... else you must point FlightGear to where you have at least the base data stored.

There is also a rfgbats[nn].zip, containing a set of batch files that can be used to run various scenarios of FlightGear. This unzips into the bin/bats folder - these are of the form rfg????.bat ... there is also a fghelp.bat and fgaircraft.bat to give command line help, and list the aircraft available ... most use a setroot.bat to establish the location of the DATA ...

Geoff McLane.
16 September, 2008 - 9 March, 2008 - 6 August,2007

PS: There are some older builds using MSVC8, but these would be well out of date now. The current soltuion files are for MSVC9, and can NOT be loaded by MSVC8 or earlier. I may at some time also provide a MSVC6 DSW/DSP set to be compatible with ALL version of MSVC, but this is to come ... the free Express edition of this MS tool can be downloaded using their new Web Install interface.

EOF - README.fgfs.htm.


checked by tidy  Valid HTML 4.01 Transitional