Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-22 09:45:49


On Thursday 15 September 2005 10:54, Reece Dunn wrote:

> > When we talked about it before, the general agreement was to never use
> > automatic pch, but instead use manual mode. MSVC users said it's much
> > more reliable.
>
> It also gives you greater control. There are 3 options (disregarding
> automatic mode):
>
> * create-pch -- generate PCH compiled with this source, giving the PCH
> a specific name. E.g.
>
> cl pch.cpp -Yc"pch.h"
>
> or, in BBv2:
>
> # <pch-file> implies create-pch
> obj pch : pch.cpp : <pch-file>pch.hpp ;

Can't be have

pch my_pch : pch.hpp ;

and automatically create "pch.cpp" containing just a single include?

> * use-pch -- this tells the compiler that the file is using PCHs, so it
> looks for
>
> #include "pch.h" // or whatever <pch-file> is set to
>
> MSVC option is -Yu. In general, if you have PCHs enabled, PCH is on by
> default, i.e.
>
> <pch-file>[something]/<pch>default : -Yu ;

Should the -Yu option specify the name of produced PCH file, or original
header file, or what? And where the create PCH file is placed?

> * don't-use-pch -- this tells the compiler there isn't an include for
> pch.h and so it shouldn't use PCHs. In general, you would need to
> control this for a few files only:
>
> obj non_pch : non_pch.cpp : <pch>off ;

It might be possible to just don't specify <pch-file> on such target, no?
On the other hand, one can use <pch-file>something in top-level project
requirements and use <pch>off deep in derived project to disable PCH for a
single target.

> Therefore, we have the following:
>
> <pch-file> -- A text string that is the PCH file to use. If this is
> empty, PCHs are off.
> <pch>default off -- Used to control files that use PCHs.
>
> NOTE: Since BBv2 is doing #include scanning, it should be possible to
> automatically scan for <pch-file> in the top-level source file and if
> found, enable PCHs. This would be much simpler to use and would be the
> preferred way to go, but it would make the implementation more complex
> and I don't know enough about incluse scanning internals to implement
> this.

That's very hard, I'm afraid.

> Alternative: if you could specify the PCH source file as a <pch-source>
> option, whast happens if you have something like:
>
> exe foo : foo.cpp : <pch-source>pch.cpp <pch-file>pch.h ;
> exe bar : bar.cpp : <pch-source>pch.cpp <pch-file>pch.h ;

I don't understand the question, sorry.

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: 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