From: Andrey Melnikov (melnikov_at_[hidden])
Date: 2005-07-06 10:49:24
Vladimir Prus wrote:
> Hi Andrey,
> Hi Jim,
>>>2. In my compiler flags <cflag> I'd like to reference the output
>>>directory (the one we changed in 1). This is for this specific instance
>>>for precompiled headers, so the actual flag I want to pass is something
>>>like this (but of course I don't know the proper variablenames):
>>It isn't a good idea to specify cflags manually in jamfile. It's better
>>to patch msvc.jam toolset definition file and create features like
>>Also you need to track dependencies correctly: all files with <pch>use
>>should depend on StdAfx.pch, and stdafx.cpp should create StdAfx.pch
>>Can someone more fluent in bbv2 tell me is this a lot of work?
> This PCH thing becomes a common request. Recall that msvc has both "automatic"
> pch mode, that requires, IIRC, a single switch, and "manual" mode, that
> requires creating PCH once, and then using it from other targets.
I named "automatic" mode "hdrstop", because it requires #pragma hdrstop.
Borland compilers support #pragma hdrstop too, and Jamfile with
<pch>hdrstop would be portable at least between intel-win, msvc and borland.
Another thing to consider is that MSVC2005 deprecates this "hdrstop" method.
> I recall
> I've suggested the following syntax for the manual mode:
> pch stl : stl.h :
> exe my : my.cpp : <pch>stl ;
This would be perfect. But what about stl.cpp? It's a file with single
#include "stl.h" line. It's required to create stl.obj. And stl.obj then
should be linked into my.exe. Do you think all these things can be
supported with this simple syntax?
> I think this should not be too hard to add.
>>Also I wonder how other compilers besides msvc implement precompiler
> borland, como, gcc
But HOW do they implement this feature? What users have to do besides
adding command line switches to enable them? I know 2 methods: including
special header and #pragma hdrstop. I wonder how portable precompiled
headers can be.
>>It looks like bcb can use #pragma hdrstop too.
> And, BTW, I forgot that #pragma hdrstop does ;-) Gcc does not have it, IIRC.
When automatic precompiled headers are enabled, compiler adds headers to
precompiled header database until it reaches #pragma hdrstop:
std::cout << "Hello!\n";
In this case <iostream> will be precompiled, and hello.h won't.
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