Boost logo

Boost-Build :

Subject: Re: [Boost-build] Generator's target build directory?
From: Alexander Sack (pisymbol_at_[hidden])
Date: 2008-11-10 12:45:19


On Mon, Nov 10, 2008 at 12:20 PM, Vladimir Prus <ghost_at_[hidden]> wrote:
> 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)

I will give this a try shortly...

> 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.

Boost.Build does not associate CPP with *.cc files as I see it. Maybe
I'm wrong. But the protoc binary productes .cc extension C++ source
files. Boost.Build seems to want .cpp. Can I just type register CC
as CPP? That was going to be my next try.

i.e. after it calls protoc it then calls g++ expecting my target to be
named $(target).cpp etc.

Thanks Vladmir btw...

-aps


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