|- CMake -|- OSG -|- Ready -|- Build -|- Downloads -|- Summary -|- End -|

I had been building my own Microsoft Visual C++ .NET 2003 (MSVC7) solution files for the components of OSG, and including them in my SINGLE SOLUTION FILE - see previous, but here decided to try the 'make' utility OSG recommend ... that is, CMake - see - http://www.cmake.org/HTML/Index.html - the cross-platform, open-source make system. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice, and that includes MSVC7.


I downloaded the full CVS source, in case I wanted to build it myself, but it is real simple to downloaded the CMake Windows Installer -

Windows (Win32 Installer)


This installer ran smoothly, and I had a new GUI program item available -
New CMake program item
During the install, you are asked if you want a path to CMake added, so you can also run it as a command line tool, but this is not really necessary.



From the OSG site -> Documentation -> Getting Started, it looks very simple ...

(a) Download OpenSceneGraph - I used SVN to check out the development version of OSG ... since I had already done this, I just changed into the folder and used 'svn up', to get a full update of the latest (20070528).

(b) You can OPTIONALLY download the 3rdParty_Win32binaries, namely -
23/05/2007 16:31 7,237,421 3rdParty_Win32binaries_2005_05_10.zip
but it seems this is really NOT necessary, at this time.

I NEVER use the SVN download/update folder for building. I always copy the FULL SOURCES to another folder, in this case - G:/FG/10 - I used my powerful SETUPFG.BAT batch file to copy ALL the SVN/CVS sources into appropriate folders, but this requires that ALL the sources are arranged per my source folder setup. Inside that folder, the batch file created an OpenSceneGraph folder, filled with the copied SVN source.

in the NEW G:/FG/10 folder -
Work folders, including 3rdParty folder

Note, 3rdParty and OpenThreads folders are _NOT_ required, and are not created by my latest SETUPFG.BAT batch file.


Ready For The CMake Build

Wow, it could not have been simpler! As the OSG web site generally states -
1. Launch CMake from the start menu.
2. Drag and drop OSG CMakeLists.txt into the frame, and choose your MSVC IDE tool version.
3. Click 'Configure' and wait ... I had to do this twice to get the 'Ok' to un-grey!
4. Fill in, if any, missing mandatory fields - CMake pops up an 'Error' dialog in the configuration process if something went wrong. Click 'Configure' again. I had none ;=))
5. Click 'Ok' to 'Generate'.

And a MSVC7 solution file, and the project files (124!) were generated. Loading this OpenSceneGraph.sln into MSVC7, selecting Release, and pushing build (F7), built the 60 or so projects without a hitch. I only built the Release configuration. In almost no time at all, I had some 83 OSG DLL (shared libraries) built! Ready for the following full build of FlightGear, using my SINGLE SOLUTION FILE ... What a breeze this was ...


Build FlightGear

I downloaded my vc7sln02.zip, where I have deleted all the OSG projects, and unzipped it into the new G:/FG/10 folder. I had to make one correction to alc.cpp to get it to compile, and link. Using my adjusted my upd.bat batch file, which also copies ALL the OSG DLL files to the bin folder, I started FlightGear.exe, and IT FLEW! As now becoming usual, I got a frame rate in the high 80-90 fps range, and with no 'warning' messages ;=))

So my SINGLE SOLUTION FILE, has become a TWO SOLUTION SYSTEM (TSS) ;=)) First build OSG separately, which by the way now INCLUDES OpenThreads, so this does not have to be done separately. The my fgfs.sln pulls it all balance together.



fgvc7rt02.zip - A release configuration of flightgear.exe, together with all the DLL (shared libraries) needed to run the application.

vc7sln02.zip - My TWO SOLUTION SYSTEM - All the MSVC7 project files to build FlightGear, excluding the build of OSG.

Note these zips are stored on a separate server (different domain). This is the index page containing these zips, and all the previous (and later) versions as well, in that domain.



This file, README.fgfs.txt, is include in the above vc7sln02.zip file, and is repeated here just for convenience ...

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.

1. Download, and install CMake - http://www.cmake.org/HTML/Download.html -

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 ?.? -> Cmake application, ready for use when you have all the sources in place.

2. Download, or update ALL the SOURCES.

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

a. FlightGear - This includes FlightGear source and data (base package).
 CVS - http://www.flightgear.org/cvs/anoncvs.html

b. Prerequisites - in no particular order -

-- Glut (FreeGlut) - OpenGL Utility Toolkit (GLUT) library -
 CVS - http://sourceforge.net/cvs/?group_id=1032
 Folder: <update>\freeglut
-- OpenAL - Cross Platform 3D Audio. -
 SVN - http://www.openal.org/downloads.html - 2 components OpenAL and ALut
 Folder: <update>\OpenAL
-- PLIB - portability libraries. -
 SVN - http://sourceforge.net/svn/?group_id=382
 Folder: <update>\PLIB
-- SimGear - simulation construction tools -
 CVS - http://www.simgear.org/cvs.html
 Folder: <update>\Simgear
-- Zlib - A Massively Spiffy Yet Delicately Unobtrusive Compression Library.
 tar.gz - http://www.zlib.net/
 Folder: <update>\zlib-1.2.3
-- pthreads - POSIX Threads for Win32 - (optional)
 CVS - http://sources.redhat.com/pthreads-win32/
 Folder: <update>\pthreads
-- OpenSceneGraph (OSG) - 3D graphics toolkit, and dependencies
 SVN - http://www.openscenegraph.com/index.php -> Downloads -> Subversion Repository
 Folders: <update>\OpenSceneGraph

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%\OpenAL\. 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%\FlightGear\data\. goto ERR2

The only OPTIONAL item is 'pthreads'. This can be excluded from the simgear and flightgear projects. OpenAL can be downloaded in an SDK form, but I have not tried this. freeglut can be replaced with the original GLUT (OpenGL) - http://www.xmission.com/~nate/glut.html - but again I have not tried this ...

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 ( http://unxutils.sourceforge.net/ ) or my own Directory Compare ( http://geoffmclane.com/ms/dc4w.htm ), 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 SINGLE SOLUTION FILE with MSVC7 ... 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, fgfs, FlightGear, freeglut, OpenAL, OpenSceneGraph, PLIB, pthreads, SimGear, and zlib-1.2.3.

4. Building OSG

(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 MSVC7. 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-greyed, then click [ Ok ]. This should build the MSVC7 OSG solution set.
(c) Load OpenSceneGraph.sln into MSVC7, 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).

5. Building FlightGear

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

There may also be a srcchgnn.zip, if I needed to change any files during the build. This presently include alc.cpp, but it can be none. 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 MSVC7, 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. 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 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. Upd.bat can also take one command, 'D', to also copy the Debug configuration as well as the Release configuration.

If you have not previously installed OpenAL, then change into the <work>\<build>\bin/OpenAL folder, and run the UPD.BAT batch file there. This will copy three DLLs - alut.dll, OpenAL32.dll and wrap_oal.dll to C:\WINDOWS\System32. Correct this batch file is this NOT where 'Windows' is installed. Also note these may conflict with any cygwin OpenAL DLLs installed, when trying to run FG under cygwin.


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 rfgbats02.zip, containing a set of batch files that can be used to run various scenarios of FlightGear.

EOF - README.fgfs.txt.


Geoff R. McLane
email address
May 28, 2007.

Valid HTML 4.01 Transitional  checked by tidy