Boost logo

Boost-Build :

Subject: Re: [Boost-build] Can't get output from the print rule?
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2010-07-10 12:05:40


On 7/10/2010 10:50 AM, John Maddock wrote:
>>> I'm trying to use the print.jam file to generate a cpp file, so I have:
>>>
>>> print.output t.cpp ;
>>> print.text "hello" ;
>>>
>>> In my custom rule, but no file t.cpp is ever created. If I leave out
>>> the print.output part then I do see output to console though.
>>
>> It needs to be inside a rule:
>>
>> rule generate-source ( target : sources * : properties * )
>> {
>> print.output $(target) ;
>> print.text "hello" ;
>> }
>>
>> make t.cpp : : @generate-source ;
>>
>> I'll write some documentation for this.
>
> Thanks Steven,
>
> I've sort of got this working now, but I had to define a new feature in
> order to get the text of the file passed into the generate-source rule,
> is there an easier way?

The only easier way at the moment is part of the extension utilities
<https://svn.boost.org/svn/boost/sandbox/tools/build_extensions/>. I
wrote a "text" target utility where you specify the text in the target
declaration itself. For example scroll down to "extension.text: in the
irrlicht.jam extension
<https://svn.boost.org/svn/boost/sandbox/tools/build_extensions/ext/irrlicht.jam>.
I could try and port that utility to a more general location? But the
way it gets the text into the target is using a module global var. So I
guess you could do the same.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org (msn) - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim,yahoo,skype,efnet,gmail

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