Automatically enable precompiled headers for Qt modules

We'll use the master depends header for the module as the precompilation
header. We could use the master include, but tests show that
precompilation benefits taper off for big precompiled headers. The
important part is to get the Standard Library headers precompiled.

Each module can still override which header to precompile by setting
PRECOMPILED_HEADER after load(qt_modules). It can also turn off
precompiled headers by setting that to empty or by CONFIG -=
precompile_header.

Testing a few build times shows the following improvements (GCC 4.8 with
-O3 and C++11):
  QtPrintSupport: 14.7%
  QtOpenGL:       22.7%
  QtDBus:         29.5%
  QtSvg:          -2.4%
  QtXmlPatterns:  26.1%
  QtQml:          21.6%
  QtQuick:        25.0%
  QtMultimedia:    9.0%
  QtSerialPort:  -30.0%
  QtHelp:          5.6%

The numbers also show that precompilation is worse for small modules.

Change-Id: I3793fafcedaff5456527cd6b3777ffd162975c36
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Thiago Macieira 2014-02-28 23:15:37 -08:00 committed by The Qt Project
parent f2a3307cef
commit cb09e1e889

View File

@ -64,4 +64,6 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD
}
SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
isEmpty(PRECOMPILED_HEADER): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER
CONFIG += qt_install_headers