Boost logo

Boost-Build :

Subject: Re: [Boost-build] Get full source path in generator rule
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-03-30 10:41:56


On Monday 30 March 2009 16:07:46 Алексей М. Бадяев wrote:
> Hi
> Sorry for my bad English please.
> I have my own generator (similar as headers-to-doxyfile rule in doxygen.jam)
> And in the rule, named same as corresponding action, I need full path to
> sources, provided to generator.
> Below is text of my rule. But my code is not work - $(files) is emty...
> Help me please solve this problem.
>
> rule headers-to-projfile ( target : sources * : properties * )
> {
> local text "# Generated by Boost.Build version 2" ;
> local output-dir = [ on $(target) return $(LOCATE) ] ;
> text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ;
> local files ;
> for local src in $(sources) {
> files += [ on $(src) return $(LOCATE) ] ;
> }

The LOCATE variable is only set for generated targets, not for leaf targets. In
fact, the rule/action pair that is used to build the final build command is a
slightly lower level than you need. I suggest you define your own generator
class, and then the 'run' method will be passed a list of virtual-target objects.
Those have the 'path' method.

- Volodya


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