Boost logo

Boost-Build :

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


On Mon, Nov 10, 2008 at 6:22 PM, Alexander Sack <pisymbol_at_[hidden]> wrote:
> On Mon, Nov 10, 2008 at 3:53 PM, Vladimir Prus
> <vladimir_at_[hidden]> wrote:
>> Alexander Sack wrote:
>>
>>> 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)
>>>>
>>>> to get the directory where the target should be placed.
>>>
>>> Using the above I am to get the protoc create the pb.cc file in the
>>> right spot (thanks again) and then rename it by just issuing a copy
>>> command. However, now my issue is the generated header file, *.pb.h.
>>> Right now its in obviously a variant build directory. How the heck do
>>> I include this file in other targets? I'm thinking the simple
>>> generator model is not going to cut it because of this (so close too).
>>
>> See:
>>
>> http://www.boost.org/boost-build2/doc/html/bbv2/reference/generated_headers.html
>>
>> and make sure your generator declares "H" as out of outputs.
>
> As always Vladimir, thank you. I will attempt this....I did infact
> worked around this with a simple make target.

Unbelievable but I got it working and it rocks!!! Now I can build ANY
target that uses a .proto file and it just builds. Really fantastic
stuff but the generators stuff is so cryptic....I would have never
known about the "exact" keyword.

-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