List Info

Thread: State of PCH/msvc




State of PCH/msvc
user name
2006-04-26 11:45:58
> Hi Bojan,
> I think it's possible to allow including PCH file
right into exe:
>
>   exe hello : [ cast _ pchheader : pch.hpp ] main.cpp :
<define>ABC ;

  The above does not work, but a similar line allows bjam to
build:

exe hello
	: [ pch mypch : [ cast _ pcheader : pch.hpp ] pch.cpp ]
main.cpp
	: <define>ABC ;

  However, this still does not define ABC when compiling the
PCH (tried).

  My current workaround for this issue is to have custom
my-lib and
my-exe rules which have an additional parameter - used
libraries. So
instead of
  exe hello : mypch main.cpp ./other//other :
<define>ABC ;
I have
  my-exe hello : precompiled.cpp main.cpp :
<define>ABC : ./other//other ;

The rule detects if precompiled.cpp is among the sources and
if it is
creates an inline pch target by applying all requirements
from above
and applying <use> to the dependencies:

exe hello:  [ pch prec : [ cast _ pcheader : precompiled.hpp
] precompiled.cpp
			         : <define>ABC <use>/other//other
                   ]
                   main.cpp /other//other
                  : <define>ABC
                   ;

This adds most things to PCH. It does not, however,
propagate user
defined <cxxflags>.

> and in that case PCH will be created with right
properties. But this raises
> question about reusing of the same PCH by different
targets:
>
>   pch mypch : [ cast _ pcheader : pch.hpp ] pch.cpp ;
>   exe a : a.cpp mypch : <define>ABC ;
>   exe b : b.cpp mypch : <define>ABC ;
>
> In which case we'd need either to propagate defines,
or manually add define to
> PCH. And what should happen in this case:
>
>   pch mypch : [ cast _ pcheader : pch.hpp ] pch.cpp ;
>   exe a : a.cpp mypch ;
>   exe b : b.cpp mypch : <define>ABC ;
>
> Should it be an error?
>
> - Volodya

  I believe it should, as it defeats the purpose of
precompiled
headers. The above pch must be recreated each time either a
or b is
compiled. After a is compiled it must be regenerated for b,
with
different compile settings. On the next build it must again
be
recreated for a.

--
Bojan Resnik
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )