|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-11-16 11:08:19
On Wednesday 16 November 2005 12:00, Reece Dunn wrote:
> This is the only way I can get it working without running into bjam
> errors. Now, if you want to pass a source file, you will need:
>
> pch mypch : pch.hpp : <pch-source>pch.cpp ;
>
> exe hello
>
> main.cpp demo.cpp mypch
> ;
.....
> 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"?
First, you need to define your pch generator using custom class:
class pch-generator : generator
{
rule __init__ ( * : * )
{
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) :
$(8) : $(9) ;
}
}
generators.register
[ new pch-generator msvc.compile.pch : HPP : OBJ PCH :
<toolset>msvc ] ;
Second, override the 'run' rule of generator like this:
rule run ( project name ? : property-set : sources * )
{
local r = [ generator.run $(project) $(name) : $(property-set) :
$(sources) ] ;
return [ property-set.create <use-pch-header>whatever ] $(r) ;
}
The trick here is that this generator is the top-level one for pch target. The
first element of list returned from 'run' can be a property set that
specifies "extra usage requirements". They will be added to usage
requirements specified on the target explicitly, and passed to all
dependents, in this case, to "hello" target.
Did I explain the trick clearly enough? Or you was looking for something else?
- Volodya
>
> - Reece
>
> _______________________________________________
> Boost-build mailing list
> Boost-build_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-build
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