Thursday, 13 April 2006.
RE: MSVC Issues - am2dsp auto process
I have succeeded in enhancing am2dsp.pl, which I have called am2dsp4.pl, since it uses an enhanced am2dsp4.cfg file ... Essentially, this config file now supports an 'if Debug' ... ['else'] ... 'endif' syntax. This means for example the PLIB libraries can be separated into -
lib_path = ..\plib
add_lib = pui_d
add_lib = pui
Or the AL libraries of OpenAL32.lib and alut.lib in their respective folder locations, and zlib.lib and zlibd.lib, etc can be supported, like -
if Debug # begin DEBUG libraries
lib_path = ..\zlib-1.2.3\projects\visualc6\Win32_LIB_Debug
add_lib = zlibd
lib_path = ..\openal\win\Router\Debug
add_lib = OpenAL32
lib_path = ..\openal\alut\admin\VisualStudio6\alut\Debug
add_lib = alut
else # not Debug = Release
lib_path = ..\zlib-1.2.3\projects\visualc6\Win32_LIB_Release
add_lib = zlib
lib_path = ..\openal\win\Router\Release
add_lib = OpenAL32
lib_path = ..\openal\alut\admin\VisualStudio6\alut\Release
add_lib = alut
endif # end switch
Note, at present ONLY the switches are 'if Debug' and 'if Release' are supported, but others could be added.
Also, I have a command line switch to turn on the 'groups', as was done in the old am2dsp.pl, but it presently defaults to placing ALL the files in one 'group' called 'Source Files' ... but ...
Since FG presently has at least one duplicated source file name -
it also handles this by placing the second into a Release\Dupes, or Debug\Dupes folder respectively ... It will NOT presently handle a 3rd repeated name, but that could be done, if needed ...
If the user HAS perl installed, am2dsp4.pl has a --check switch, which 'checks' (a) the additional included directories contains a known set of headers, like say <simgear/compiler.h>, and (b) checks that the added libraries can be found in the library include folders ... and exits with a report.
Additionally, am2dsp4.pl need no longer be run ONLY in the directory of the particular source, since a new --dir name switch allows the user to specify the input directory, which now MUST have an am2dsp4.cfg file present ...
Alternatively, the config file, can be specified on the command line, like --cfg path\name, but one way or another, at least a blank config file MUST be found ...
This removal of the 'groups' of am2dsp.pl certainly MASSIVELY reduces the size of the DSP file, down to a modest 68KB, from the previous giant of over 200MB file ...
I have successfully compiled FG using MSVC6 and this new am2dsp4 system, but as AGREED this requires a VERY CONSIDERABLE EFFORT. Some 20 or 30 source files MUST be modified ... so I am NOT suggesting this!
To be able to compile and link FG (latest CVS) with MSVC6, IS CERTAINLY NOT RECOMMENDED FOR THE AVERAGE BEAR ;=)) And ONLY the Release, NOT the Debug version would compile! As usual, I have written up the experience here - http://geoffmclane.com/fg/fgfs-024.htm -
As can be read, I had to chop and change SO MANY THINGS, even I can now agree with the concept that is makes the code 'ugly', and certainly do not suggest developers try in any way to conform to MSVC6 'strange', broken ways ;=))
But am2dsp4.pl also now provides an automatic way in which MSVC7.1 can be loaded with the project ... and as stated, if the user downloads am2dsp4.pl, and runs it in 'check' mode, they should learn whether they have compiled all the necessary components first ...
Of course, am2dsp4.pl has climbed from around 30KB, to well over 40KB, but it still runs very fast ... usually just a few seconds to complete its 'interesting' task of parsing all the Makefile.am, and others, in the project ...
I have tried AGAIN to automate the custom step to copy the config.h-msvc6 to config.h before starting the compile, BUT have not yet found a way to make this consistently function in MSVC6 ... it does seem to work with MSVC7.1 and MSVC8 ...
I have placed the am2dsp4.pl, and my sample am2dsp4.cfg file on this page for others to download, and try using any version of MSVC - http://geoffmclane.com/fg/fgfs-025.htm -
I HAVE tried to build MSVC7.1 SLN/VCPROJ project files, but it seems MSVC7.1 is much more 'picky' about the formation of the XML file ... but as stated, it has no problem using the DSW/DSP starters ... and doing it own 'conversion' ...
In line with all this, I have ADDED to the README.msvc in doc-mini, and have put my new suggested file here - http://geoffmclane.com/fg/readme.msvc8.txt -
I hope shortly they can be added to CVS ... And as indicated, I hope am2dsp4.pl can also be added to the FG source folders, so users have it from a CVS update, rather than searching around the cvs tree to find it ...
However, as can sometimes happen, I abandoned this Perl project before it was ready for prime time ;=))