261days since
Charity Parachute Jump!

Amount Raised

So far the grand total raised
for my Charity Jump is


+ $0 USD via Paypal


I've set a total of £500 as a minimum value to raise, let's see how far I can push the limit!
Tools‎ > ‎

Manifest Builder

When I first started using the DragonFire SDK Windows iPhone development system I immediately noticed the limitation that all your source code has to be in a single file (a limitation that has partially revoked by allowing the use of #include files - but one that still hasn't been totally fixed!)

Obviously to anyone brought up programming C/C++ properly this limitation is just restricting so as a "workaround" to the problem I put together a simple command line app which I call ManifestBuilder - what this does is takes an XML "manifest" file containing a list of all of the files in your app (similar to the way a standard makefile does) and put's them all together into a single output file. It also strips (actually comments) out any references in your source to #include statements so you don't have to.

The idea behind making it a command line app is that so you can add it as a "post build" command to your normal Visual Studio project (it's in the Build Events section of the project property pages in Visual Studio 2008 and the Post Build step tab of the project settings in Visual Studio 6).

To use the app, download the attachment (unzip it) and either place the .exe in a location that's visible in your machines system PATH, add an entry into the system PATH to where you want to place the .exe, or simply reference the physical location where you put the .exe when specifying the command. The only argument to the app is just the name of your XML manifest file.

Once you get that setup, whenever you make a build of your project the post build event will automatically run and you'll always have the latest version of your code ready to upload...

Now as for the manifest file... If you run the app without any arguments on the command line it will display an example file on the screen, however it's just a standard XML file containing a couple of simple tags - here is a copy of the manifest file for my PipeDreams app (which when outputted currently generates a file that is almost 3,500 lines long and 157k big - and which compiled on the build server first time!)


<?xml version="1.0" encoding="UTF-8"?>
<manifest Output="app.cpp" filter_includes = "yes">
<!-- Main data -->
<copy><!-- comment --><![CDATA[
#include "DragonFireSDK.h"
// Include Files...

  <include name="BackEnd.h"/>
  <include name="Data.h"/>
  <include name="FrontEnd.h"/>
  <include name="Puzzle.h"/>
  <include name="Swipe.h"/>
  <include name="Tween.h"/>
  <include name="Utils.h"/>
  <include name="View.h"/>

// Source Files...
  <include name="BackEnd.cpp"/>
  <include name="Challenge.cpp"/>
  <include name="Data.cpp"/>
  <include name="FrontEnd.cpp"/>
  <include name="Puzzle.cpp"/>
  <include name="Quote.cpp"/>
  <include name="Swipe.cpp"/>
  <include name="Tween.cpp"/>
  <include name="Utils.cpp"/>
  <include name="View.cpp"/>
  <include name="main.cpp"/>

// End of COMPILATION file... 

The <manifest> tag is the root node and obviously the output attribute sets the output file name (which for the build server must end in .cpp) and the filter_includes attribute controls if any of the #include statements in the code are commented out in the output file - the default to this is yes if you don't explicitly tell it not to.

As you can see you just need to add a single <include name="file" /> tag for each file you want to include, with the "file" being replaced by the name of the source or header file.

The <copy> ... </copy> tag (as the name suggests) just copies the contents of the tag directly into the final source, you can see from the example above, I've used it to insert the #include "DragonFireSDK" and also to #define a FINAL_BUILD macro that could be used to turn off or conditionally compile any debug or other options in your code.

I also used the <copy> tag to help separate out the source and include files in the final output. 

NOTE : XML parsing can get a bit funny if you try and put "reserved" XML identifiers within your <copy> tag so if you want to include any C code that uses & or < or > anything similar you might need to wrap that text in a [CDATA[ ... ]] block (again see the above example)

Obviously you'll have to make sure you include your files in the correct order to prevent any forward references etc, but if the output from this app is compilable in your test environment there should be no reason why it won't work on the build server and that way you can keep all your source code nicely organised in to separate files and re-usable modules the way K & R originally intended you too. 

This software is released into the public domain and although is meant for generating build files for the DragonFire build server, it can in theory be used for any purpose. Credit is not required, and likewise no warranty or usefulness is implied or given.
Jon Howard,
30 Dec 2010 09:25