Opened 11 years ago

Last modified 11 years ago

#10 new enhancement

Precompiled headers

Reported by: dirk Owned by: dirk
Priority: major Milestone: 2.0 Release
Component: Build Version: 2.0
Keywords: Cc:

Description

We need support for precompiled headers, both in the build system and for user apps.

Change History (1)

comment:1 Changed 11 years ago by marcusl

I did some experiments today, and found that even by using _both_ precompiled headers and "normal" inclusions, compiletimes where speed up *greatly*. This is because of the include guards.

I think that could work as a sort of middle ground. It will be a great improvement _now_ for compilers that support it and it will still be backwards compatible. Futurewise, we could move to add external guards to some files that we know are precompiled.

Some .h/.cpp:

#ifndef OSG_SYSTEM_USE_PCH

#include <iostream>

#include <map>

#include <OSGBaseFoo.H>

#endif

Note that we have to #include the PCH-file in _all_ cpp libs, topmost. And we have to use include guards in that file, because visual studio assumes everything up to and including the #include-statement is in the pch. So an #endif isn't allowed afterwards.

PCH.h

#ifdef OSG_SYSTEM_USE_PCH

#include ...

#endif

Note: See TracTickets for help on using tickets.