Boost logo

Boost-Build :

Subject: Re: [Boost-build] Building a generator binary then using it?
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-10-13 17:36:03


Alexander Sack wrote:

> On Mon, Oct 13, 2008 at 5:18 PM, Alexander Sack <pisymbol_at_[hidden]> wrote:
>> On Mon, Oct 13, 2008 at 4:18 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
>>> AMDG
>>>
>>> Alexander Sack wrote:
>>>>
>>>> I have been slowly getting better at using bjam but I have this
>>>> problem. My project has a binary that we build which is then used to
>>>> generate C++ files. I have followed the documentation regarding
>>>> generators (the VERBATIM example as well as persuing my
>>>> $BOOST_ROOT/tools/*.jam files) but I don't know how to get access to
>>>> the current build directory to run my generator? Any pointers would
>>>> be most appreciated.
>>>>
>>>
>>> For a real example you can look at
>>> http://svn.boost.org/trac/boost/browser/trunk/tools/build/v2/tools/quickbook.jam
>>
>> Ouch, but this doesn't look like it does it. It looks like it
>> searches within BOOST_ROOT or BOOST_BUILD_PATH. The other thing is I
>> see a lot of stuff that I'm positive isn't really documented.
>
> Eee gad. No I'm sorry, I looked at it again. Alright this seems to
> build the quickbook and then use it. But isn't there something
> simpler than this? This is a lot of heavy lifting for such a simple
> task.

Here's a copy of email describing how to use a built tool inside actions,
which is somewhat simpler. The email was a private one, so I can't give
an archive URL :-)

Also see an example attached.

- Volodya

> Is there a proper way to specify the path to a generated executable in
> an action. In my case tablegen executable is being built at an early
> stage of the build process. Later td files are being processed, but the
> build system doesn't know where the tablegen exec is located.

I don't know the exact setup, but I suspect it's easiest to use a dependency
property. For example:

        feature.feature tblgen : : dependency free ;

        exe a : a.td : <tblgen>some/dir//tblgen_target ;

Then, the action for running tblgen should look like this:

        toolset.flags tblgen.run COMMAND <tblgen> ;

        actions unit-test bind COMMAND
        {
                $(COMMAND:E=tblgen) .......
        }

The <tblgen> property can be set as project requirement somewhere, but
please make sure that the Jamfile with the tblgen target itself does *not*
inherit the tblgen property, as otherwise an infinite building cycle will
happen. Presumably, it means tblgen should be set in lib/Jamfile, not
Jamroot.

I attach a small project that appears to do what you want. Let me know if
this works in real setup.




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