Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-11-16 16:33:48


Vladimir Prus wrote:
> 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
>> ;
>>
>> 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?
>
> Did I explain the trick clearly enough? Or you was looking for something else?

I now have:

-- pch.jam --

feature use-pch-header : : free dependency ;
feature use-pch-file : : free dependency ;

class pch-generator : generator
{
     import property-set ;

     rule __init__ ( * : * )
     {
         generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) :
$(7) : $(8) : $(9) ;
     }

     rule run ( project name ? : property-set : sources * )
     {
         local r = [ generator.run $(project) $(name) : $(property-set)
: $(sources) ] ;
         return
           [ property-set.create
              #<use-pch-header>$(targets[2])
               <use-pch-file>$(sources[2])
           ] $(r) ;
     }
}

-- msvc.jam --

generators.register [ new pch-generator msvc.compile.pch : HPP : OBJ PCH
: <toolset>msvc ] ;

which gets me part way there. This gives:

msvc.compile.pch ..\..\..\build\tools\pch\msvc-6.0\release\mypch.obj
..\..\..\build\tools\pch\msvc-6.0\release\mypch.pch
    cl -c -Yc"pch.hpp"
-Fo"..\..\..\build\tools\pch\msvc-6.0\release\mypch.obj"
-Fp"..\..\..\build\tools\pch\msvc-6.0\release\mypch.pch"
msvc.compile.c++ ..\..\..\build\tools\pch\msvc-6.0\release\main.obj
    cl -c "main.cpp"
-Fo"..\..\..\build\tools\pch\msvc-6.0\release\main.obj" -Yu"<p.>pch.hpp"

so:

1. How do I resolve the "<p.>pch.hpp" to an actual path?
$(sources[2]).actualize doesn't work (problem with foo.actualize.actualize).

2. Is it possible to get the target name for the PCH target? I took a
look at generator.jam and the target calculation looks complex!

- 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