Am2DSP FG(11)

FG-MSVC6 - FG-MSVC7 - UFO - ATLAS ( +1, +2, +3 ) - OTHERS - Favourites - Home

On FlightGear, and SimGear, being built in the WIN32 environment, using Microsoft Visual C/C++ IDE, SDK, Compiler  ...

The cross-platform nature, design even, of FlightGear and SimGear (FG-SG), poses some interesting questions. One is how to keep the make, the build, in a cross-platform way? In the *nix environment, FG-SG uses makefile.am files, which allows 'make' to be run, after a 'configuration' step, and it is all done. Effectively, the make files form a 'tree' of 'build' steps. There is a perl tool, am2dsp.pl, using an am2dsp.cfg file, which reads the 'build-tree', and writes a Microsoft Visual Studio C/C++ DSP, compatible, project files, namely SimGear.DSP, and FlightGear.DSP.

This works fine, provided they are 'regularly' re-generated. Of course, they only need regeneration when the actual source list changes ... source are added, or subtracted ... If the respective am2dsp.cfg 'reflect' a particular 'environment' layout, and if you have 'arranged' the sources as required, such a 'generated' MSVC project file should work, but seldom out-of-the-box. It will nearly always require some adjustment ...

Several times I have tried to write a console application, which could be includes, or offered separately, to allow you to 'adjust' the respective am2dsp.cfg files to perfectly suit your current desired 'environment', and run am2dsp in the WIN32 machine, to generate 'uniquely-configured-to-local-conditions' DSP files ... My latest, in source zip form is here, and exe. It does a 'reasonable' job, but falls down in several way ... see the TODO.txt ... Of course, if I installed a 'perl' shell, I could even use am2dsp.pl ... so it was done more for 'fun', rather than as any form of 'addition-to-the-perl-pearly-way' ... ;=))

Anyway, some 'understanding' of how the makefile.am system functions, helps when you need to add, or remove 'source' from the MSVC build. And the output, to a temprt.txt file, of my am2dsp.exe is used to help the 'explanation' ... It is also beneficial to open the makefile.am in an editor, and view their respective contents ...

Here is a partial sample, from SG ...

Loading: 1 [./Makefile.am] ...
Line 1 [EXTRA_DIST = acinclude.m4 README.MSVC README.zlib SimGear.dsp SimGear.dsw]
Line 2 [SUBDIRS = src-libs simgear]

Note the SUBDIRS = src-libs simgear, which indicates to the 'make' tool, to look in these two folder for further instructions. The NT console 'build' tool has a similar 'function', or 'macros', that can exist in the make files ... When simgear/makefile.am is sampled, we can find an entry like SUBDIRS = xml debug misc bucket $(METAR_DIRS) ... which takes the 'tree' down into these sub-directories ... so the project, the product, the result, in SimGear's case, a set of static libraries ...

If we sample simgear/bucket/makefile.am, we can see the first library being built -
Loading: 4 [./simgear/bucket/Makefile.am] ...
Line 1 [includedir = @includedir@/bucket]
Line 2 [lib_LIBRARIES = libsgbucket.a]
Line 3 [include_HEADERS = newbucket.hxx]
Line 4 [libsgbucket_a_SOURCES = newbucket.cxx]
Line 5 [INCLUDES = -I$(top_srcdir)]
Found 5 lines in file ...

This builds the library, libsgbucket.a, from the source(s) newbucket.cxx, using header newbucket.hxx ... and there are some 30 makefile.am files, which builds some 20 plus libraries, from some 130 sources ... at last partial count of SimGear ;=)) ... but in WIN32, all these individual SimGear libraries are 'combined' into ONE(1) SimGear.lib - a WIN32 COFF ARCHIVE file ... can be viewed with dumpbin, or even link ...

So there is a MSVC project file, that combines all the sources ... but how do you keep the 'source' list represented by a tree of makefile.am up-to-date? perl to the rescue ... the am2dsp.pl file, that is run on each distribution, to again read and summarise the make-file-tree, and 'convert' it to a MSVC project file, a DSP file ...

If you have moved on to Microsoft .NET (MSVC7), then this is still ok. The 'Solution' IDE will load DSW/DSP, version 6 project files, and convert them to the 'newer' SLN/VCPROJ, version 7 file. Maybe a non-trivial extension to am2dsp, would be to write the VCPROJ XML file ... but meantime, the am2dsp.pl perl script helps keep us WIN32 users current ...

FG-MSVC6 - FG-MSVC7 - UFO - ATLAS ( +1, +2, +3 ) - OTHERS - Favourites - Home