Generate automatically a .dsp can be usefull in several cases :
- You want to modify an existing project without rebuilding by hand the directory structure.
- You are developping a cross-platform project, and need to support other build tools. You can so include the generation of the dsp in your ./configure step.
Principles / Use
This tool operate in three steps :
- tree.xml : A tree of the files is built in tree.xml. This can be automatically done by xmlTree.py (allows to define filters), or edited by hand. This tree contains :
dirtags for the directories.
- custom tags according to the extension (for instance, header tag for .h files)
filetags for unknown files.
This distinction can be used then to generate separate Folder structure in the dsp project (for instance Sources will contain the directory structure with all .cpp files, Headers the directory structur but with .h files, and Other Files the other files)
- Makefile.xml : This file contains all the custom data for the dsp creation. You must edit this file to provide compilation/link options, and also the directory structure. The options should be expicit enough.
- dsp.xsl : This is the XSL Stylesheet that will transform your Makefile.xml in a valid .dsp file.
Important Note : Note that the input file of dsp.xsl is only Makefile.xml. The tree file (tree.xml) will be included during the process by Makefile.xml.
This Zip Package contains :
- dsp.xsl : The Stylesheet to generate the dsp.
- xmlTree.py : The python file to generate the tree.xml file (Note : you must have python installed, with libxslt2 librairies).
- Makefile.xml : An example of Makefile.xml file.
- gen.bat : A batch file containing the command to generate the .dsp file (if not using xmlTree.py)
- tree.ml : A sample of tree.xml file.
Disclaimer / Recommandations
Note that this tool is highly alpha software. Because dsp files are very sensitive, it may fail several times. Try to edit by hand the generated file to see what could be wrong. Especially, do not put extra space or carriage returns in the tags of the Makefile.xml.
Here are some pre-configured packages (take this as samples) :
- C’Nedra : sample package to generate the client’s dsp.
- OpenOffice.org : sample package to generate a dsp for OpenOffice. Note that this dsp is only intended to browse the files, and not to build. The loading is very very long (approx. 5mn on my Athlon2000 machine), and can sometimes crash (especially when using the class browser : disable it.)
Here is a win32 version of xsltproc. (Check the home site of xsltproc for updates).
I began to adapt this piece of software to generate .vcproj files, ie the new file format replacing the .dsp in VS.Net. You can download the vcproj’s stylesheet. The stylesheet works, but compiler and linker options are not yet supported.
Here is the resulting file for OpenOffice.org 1.0.2. VS.Net is a bit more stable for huge projects. The file is still very long to load (> 5mn), and there are sometimes heavy loads, but VS.Net does not crash if you are patient 🙂