Disable precompiled headers for small modules

Creating a precompiled header exclusively for a one- or two-file module
is wasteful. The time that it takes to build the precompiled source is
on the same order as a regular compilation, so enabling precompiled
headers for those modules just makes the build slower.

Also make it possible to override the precompiled header by just setting
PRECOMPILED_HEADER to empty.

Change-Id: I0e1a09998253489388abfffd14b5f221288c4826
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Thiago Macieira 2017-04-16 10:51:15 -07:00
parent 255d291efd
commit 47c9b66a8b
10 changed files with 11 additions and 14 deletions

View File

@ -157,12 +157,18 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD
}
SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
# Automatically enable precompiled headers for Qt modules,
# except for Gcc/Windows: Larger precompiled headers crash cc1plus.exe
# (e.g. with i686-4.8.2-release-posix-dwarf-rt_v3-rev3)
!if(gcc:equals(QMAKE_HOST.os, Windows)):!equals(TEMPLATE, aux) {
isEmpty(PRECOMPILED_HEADER): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER
# Automatically enable precompiled headers for Qt modules with more than 2 sources
combined_SOURCES = $$SOURCES $$OBJECTIVE_SOURCES
count(combined_SOURCES, 2, >) {
# except for Gcc/Windows: Larger precompiled headers crash cc1plus.exe
# (e.g. with i686-4.8.2-release-posix-dwarf-rt_v3-rev3)
!if(gcc:equals(QMAKE_HOST.os, Windows)):!equals(TEMPLATE, aux) {
!defined(PRECOMPILED_HEADER, "var"): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER
}
} else {
CONFIG -= precompile_header
}
unset(combined_SOURCES)
headersclean:!internal_module {
# Make sure that the header compiles with our strict options

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += \
qaccessiblebridgeutils_p.h

View File

@ -5,7 +5,6 @@ QT = core-private gui
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += \
cglconvenience_p.h

View File

@ -5,7 +5,6 @@ QT = core-private gui
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += qmacmime_p.h
SOURCES += qmacmime.mm

View File

@ -6,7 +6,6 @@ QT_FOR_CONFIG += gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += qdevicediscovery_p.h

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
LIBS_PRIVATE += $$QMAKE_LIBS_X11

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS += $$PWD/qrasterbackingstore_p.h
SOURCES += $$PWD/qrasterbackingstore.cpp

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
HEADERS +=
qkmsdevice_p.h

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
SOURCES += \
qopenglcompositor.cpp \

View File

@ -5,7 +5,6 @@ QT = core-private gui-private
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
unix:!darwin: \
include($$PWD/genericunix/genericunix.pri)