Boost logo

Boost-Build :

Subject: Re: [Boost-build] custom generator problems
From: Michael Caisse (boost_at_[hidden])
Date: 2009-03-17 02:26:49


Hello Volodya -

Thank you for taking time to respond.

Vladimir Prus wrote:
On Sunday 08 March 2009 08:12:57 Michael Caisse wrote:
  
I am trying to create a custom generator for a code generator.
The code generator takes a single description file in and
produces several CPP and HPP files.

The produced filenames are not known before hand; however, I
have them generated into a known directory. I was hoping to
path.glob the code generated files but I am starting to think
that this isn't going to work.

Before I devote much more time to this approach is this even possible?
Can I create rules that determine targets only after some
action is performed (the code generator runs and the directory is glob'd)?
    

Hmm, how are you planning on doing dependency analysis in this case?
Say, your tool takes a.in and produces a bunch of cpps. To know if the
tool should be run, we need to compare checksum of a.in with the checksums
of the files it will produce -- and running the tool in the first
place seems wasteful. The tool itself might run in no time, but the .cpp
files need compilation.
  

One thought was to take a.in and produce an empty (touch) a.out file for
timestamp/dependency purposes. The tool would then create the various .cpp and
.h files in a known directory containing only the generated sources. My problem
has been finding a way to feedback the generated .cpp files as targets that
now need to be compiled.

Is there any reasonable way to extract the names from the input file? (Say,
using a Python script). If so, you can build Boost.Jam with Python support
and run this code to determine the file names.
  
This might be possible. If I were to attempt this, is there an example of
building/using bjam with Python support?

If the above is not possible -- is it possible to write a script that runs
the tool, but in a temporary directory, and reports the list of files
that are produced? Such a script can be then run using SHELL builtin.


  
This is possible. Sorry if I am slow, but I don't see how I will get the generated
filenames into Boost.Build afterward so that the .cpp will be compiled.


Thank you for your time.

Best Regards -
Michael

-- 

----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk