Boost logo

Boost-Build :

Subject: Re: [Boost-build] Generator's target build directory?
From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-11-10 12:20:40


On Monday 10 November 2008 18:34:15 Alexander Sack wrote:
> I am trying to create a simple generator for Google's protobuf tool
> which has the following syntax:
>
> protoc --cpp_out="<some directory>" <sourcefiles>
>
> This will turn:
>
> MyProtoBufs.proto --> MyProtoBufs.pb.cc and MyProtoBufs.pb.h
>
> My issues are:
>
> 1) I don't know what to put in <some directory> to bjam can pick up
> the resulting CPP source file so the corresponding compilation fails,
> i.e. can I get the current target build (this my main issue)

Assuming your generator is defined to accept PROTO targets, and generate CPP
and H targets, then inside the action associated with your generator you can use:

        $(<[1]:D)

to get the directory where the target should be placed.

> 2) The resulting file is .cc instead of .cpp, is there any reason by
> bjam doesn't recognize either? (obviously I can try to use basename
> and rename the files, but I still need to figure out question 1)

What 'does not recognize' mean? A generator is producing Boost.Build targets
of specific types, and those types are associated with some extension. When
the tool is actually run, it has to produce the files with the same names that
Boost.Build wants, otherwise things won't work very well.

- 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