|
Boost-Build : |
From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-11-16 15:29:08
Vladimir Prus wrote:
> On Wednesday 16 November 2005 12:00, Reece Dunn wrote:
>
>> Now, for each CPP target that is using PCHs (CPP/<pch>on) I need to add
>> -Yu"pch.hpp" and
>> -Fp"..\..\..\build\tools\pch\msvc-7.1\release\mypch.pch". The only way I
>> han think of doing this is to have a <use-pch-header> for -Yu and
>> <use-pch-file> for -Fp. I could then use the technique used by 'lib : :
>> <name>' by adding <library-file> to the list of properties. Then:
>>
>> flags msvc.compile USE_PCH_HEADER : <use-pch-header> ;
>> flags msvc.compile USE_PCH_FILE : <use-pch-file> ;
>>
>> Q: How do I get these features added into the property list via the pch
>> rule?
>
> You mean, to to add <use-pch-header> to build properties of "hello"
> automatically, just because "hellow" uses "mypch"?
Yes.
> First, you need to define your pch generator using custom class:
>
> class pch-generator : generator
> {
import property-set ;
^^^^^^^^^^^^^^^^^^^^^ -- this tripped me up!
(I put the import at the top of the file).
> rule __init__ ( * : * )
> {
> generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) :
> $(8) : $(9) ;
> }
rule run ( ... ) ...
> }
>
> generators.register
> [ new pch-generator msvc.compile.pch : HPP : OBJ PCH :
> <toolset>msvc ] ;
>
> Did I explain the trick clearly enough?
Enough for me :).
> Or you was looking for something else?
No. This was exactly what I was looking for.
Coming Soon to a build system near you: Boost Build and the Pre-Compiled
Header ;)
- Reece
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