Boost logo

Boost-Build :

Subject: Re: [Boost-build] generating a header file
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-10-23 05:12:08


On Monday, October 18, 2010 18:19:50 Jonathan Brannan wrote:

Hi Jonathan,

> I'm trying to get a rule to generate header files with ruby code.
> Optimally I'd like to be able to generate a header and/or a cpp, but for
> now a header will be fine. Generation of just a cpp worked as explained
> in the documentation, however I was unable to get the the action rule for
> the header file to be called:
>
> I was attempting something like:
> import type ;
> type.register RBHPP : rbhpp ;
> actions make-header
> {
> ...
> }
>
> generators.register-standard rbconvert.make-header : RBHPP : HPP ;

Good so far -- you've told Boost.Build that whenever it wants to create HPP
from RBHPP, it can use the 'make-header' action.

>
> Then I have a
> obj Foo.o : Foo.cpp : <dependency>Foo.rbhpp ;

This tells that Foo.o depends on file Foo.rbhpp, however,
nothing above tells Boost.Build that file Foo.hpp should
be produced.

> If i touch Foo.rbhpp, it will rebuild Foo.cpp. However it will never try
> and and execute the actions.
>
> If is replace s/hpp/cpp. It works as expected (putting Foo.rbcpp in the
> sources location).
>
>
> Do I need to use a more advanced generator class to make the actions to
> execute?

Just:

        hpp Foo : Foo.rphpp ;

should do the trick. Or, you can put both Foo.cpp and Foo.rbhpp in the
sources of whatever metarget uses them now.

HTH,

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: http://boost.org/boost-build2

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