Use Qt CMake APIs to exclude files from Unity Build
This is a bit of a cleanup, mainly around unity build, and a few other minor things: - I replaced the direct inclusion of sources files using `set_source_files_properties`, and instead used `NO_UNITY_BUILD_SOURCES` when possible. In most cases, they are being excluded in their respective `qt_internal_extend_target` but sometimes I had to make a new extension. - In few cases, we had to manually exclude the NO_PCH files, so, I instead passed them directly to the NO_PCH_SOURCES which also exclude them from the unity build as well. - Removed a few unnecessary "" Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I466576592c1d115a2da4d88672c1e4b9f995f2ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
c19504e708
commit
7e074bd8a0
@ -315,6 +315,13 @@ qt_internal_add_module(Core
|
|||||||
# despite the fact that appropriate checks are in place to avoid that!
|
# despite the fact that appropriate checks are in place to avoid that!
|
||||||
tools/qshareddata.cpp tools/qshareddata.h
|
tools/qshareddata.cpp tools/qshareddata.h
|
||||||
text/qlocale.cpp text/qlocale.h
|
text/qlocale.cpp text/qlocale.h
|
||||||
|
global/qglobal.cpp # undef qFatal
|
||||||
|
global/qlogging.cpp # undef qFatal
|
||||||
|
text/qstringconverter.cpp # enum Data
|
||||||
|
tools/qcryptographichash.cpp # KeccakNISTInterface/Final
|
||||||
|
NO_PCH_SOURCES
|
||||||
|
compat/removed_api.cpp
|
||||||
|
global/qsimd.cpp
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_NO_FOREACH
|
QT_NO_FOREACH
|
||||||
QT_NO_USING_NAMESPACE
|
QT_NO_USING_NAMESPACE
|
||||||
@ -342,15 +349,6 @@ qt_internal_add_module(Core
|
|||||||
)
|
)
|
||||||
_qt_internal_setup_deploy_support()
|
_qt_internal_setup_deploy_support()
|
||||||
|
|
||||||
set(corelib_no_pch_sources
|
|
||||||
compat/removed_api.cpp
|
|
||||||
global/qsimd.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
foreach(src ${corelib_no_pch_sources})
|
|
||||||
qt_update_ignore_pch_source(Core ${src})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_dependencies(Core qmodule_pri)
|
add_dependencies(Core qmodule_pri)
|
||||||
|
|
||||||
if (NOT QT_NAMESPACE STREQUAL "")
|
if (NOT QT_NAMESPACE STREQUAL "")
|
||||||
@ -523,7 +521,6 @@ qt_internal_extend_target(Core CONDITION WIN32
|
|||||||
kernel/qwinregistry.cpp kernel/qwinregistry_p.h
|
kernel/qwinregistry.cpp kernel/qwinregistry_p.h
|
||||||
plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h
|
plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h
|
||||||
thread/qthread_win.cpp
|
thread/qthread_win.cpp
|
||||||
# DEFINES # special case: remove
|
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
advapi32
|
advapi32
|
||||||
authz
|
authz
|
||||||
@ -541,6 +538,19 @@ qt_internal_extend_target(Core CONDITION WIN32
|
|||||||
userenv
|
userenv
|
||||||
)
|
)
|
||||||
|
|
||||||
|
qt_internal_extend_target(Core CONDITION WIN32
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
global/qsimd.cpp # Q_DECL_INIT_PRIORITY
|
||||||
|
serialization/qcborvalue.cpp # various windows.h clashes
|
||||||
|
serialization/qjsoncbor.cpp
|
||||||
|
serialization/qjsonvalue.cpp
|
||||||
|
serialization/qxmlstream.cpp
|
||||||
|
text/qbytearray.cpp
|
||||||
|
text/qlatin1stringmatcher.cpp
|
||||||
|
text/qunicodetools.cpp
|
||||||
|
tools/qhash.cpp # Q_DECL_INIT_PRIORITY
|
||||||
|
)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
### Qt7: remove
|
### Qt7: remove
|
||||||
# Make qwineventnotifier.h available on non-Windows platforms too for code bases that include
|
# Make qwineventnotifier.h available on non-Windows platforms too for code bases that include
|
||||||
@ -941,6 +951,8 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_process AND UNIX
|
|||||||
SOURCES
|
SOURCES
|
||||||
../3rdparty/forkfd/forkfd.h
|
../3rdparty/forkfd/forkfd.h
|
||||||
io/forkfd_qt.cpp
|
io/forkfd_qt.cpp
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
io/forkfd_qt.cpp # EINTR_LOOP macro clashes
|
||||||
INCLUDE_DIRECTORIES
|
INCLUDE_DIRECTORIES
|
||||||
../3rdparty/forkfd
|
../3rdparty/forkfd
|
||||||
)
|
)
|
||||||
@ -1115,6 +1127,8 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_cborstreamreader
|
|||||||
qt_internal_extend_target(Core CONDITION QT_FEATURE_cborstreamwriter
|
qt_internal_extend_target(Core CONDITION QT_FEATURE_cborstreamwriter
|
||||||
SOURCES
|
SOURCES
|
||||||
serialization/qcborstreamwriter.cpp serialization/qcborstreamwriter.h
|
serialization/qcborstreamwriter.cpp serialization/qcborstreamwriter.h
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
serialization/qcborstreamwriter.cpp # CBOR macro clashes
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_internal_extend_target(Core CONDITION QT_FEATURE_mimetype
|
qt_internal_extend_target(Core CONDITION QT_FEATURE_mimetype
|
||||||
@ -1295,31 +1309,11 @@ set_source_files_properties(
|
|||||||
thread/qmutex_unix.cpp
|
thread/qmutex_unix.cpp
|
||||||
PROPERTIES HEADER_FILE_ONLY ON) # special case: These files are included by qmutex.cpp!
|
PROPERTIES HEADER_FILE_ONLY ON) # special case: These files are included by qmutex.cpp!
|
||||||
|
|
||||||
set_source_files_properties(serialization/qcborstreamwriter.cpp # CBOR macro clashes
|
|
||||||
io/forkfd_qt.cpp # EINTR_LOOP macro clashes
|
|
||||||
global/qglobal.cpp # undef qFatal
|
|
||||||
global/qlogging.cpp # undef qFatal
|
|
||||||
text/qstringconverter.cpp # enum Data
|
|
||||||
tools/qcryptographichash.cpp # KeccakNISTInterface/Final
|
|
||||||
${corelib_no_pch_sources} # NO_PCH_SOURCES
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
# Remove QT_NO_CAST_TO_ASCII to ensure that the symbols are included in the library.
|
# Remove QT_NO_CAST_TO_ASCII to ensure that the symbols are included in the library.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
get_target_property(defines Core COMPILE_DEFINITIONS)
|
get_target_property(defines Core COMPILE_DEFINITIONS)
|
||||||
list(REMOVE_ITEM defines QT_NO_CAST_TO_ASCII)
|
list(REMOVE_ITEM defines QT_NO_CAST_TO_ASCII)
|
||||||
set_target_properties(Core PROPERTIES COMPILE_DEFINITIONS "${defines}")
|
set_target_properties(Core PROPERTIES COMPILE_DEFINITIONS "${defines}")
|
||||||
|
|
||||||
set_source_files_properties(global/qsimd.cpp # Q_DECL_INIT_PRIORITY
|
|
||||||
serialization/qcborvalue.cpp # various windows.h clashes
|
|
||||||
serialization/qjsoncbor.cpp
|
|
||||||
serialization/qjsonvalue.cpp
|
|
||||||
serialization/qxmlstream.cpp
|
|
||||||
text/qbytearray.cpp
|
|
||||||
text/qlatin1stringmatcher.cpp
|
|
||||||
text/qunicodetools.cpp
|
|
||||||
tools/qhash.cpp # Q_DECL_INIT_PRIORITY
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_internal_apply_gc_binaries_conditional(Core PUBLIC)
|
qt_internal_apply_gc_binaries_conditional(Core PUBLIC)
|
||||||
|
@ -275,7 +275,7 @@ qt_internal_add_module(Gui
|
|||||||
PRIVATE_MODULE_INTERFACE
|
PRIVATE_MODULE_INTERFACE
|
||||||
Qt::CorePrivate
|
Qt::CorePrivate
|
||||||
NO_PCH_SOURCES
|
NO_PCH_SOURCES
|
||||||
"painting/qdrawhelper.cpp"
|
painting/qdrawhelper.cpp
|
||||||
PRECOMPILED_HEADER
|
PRECOMPILED_HEADER
|
||||||
"kernel/qt_gui_pch.h"
|
"kernel/qt_gui_pch.h"
|
||||||
GENERATE_CPP_EXPORTS
|
GENERATE_CPP_EXPORTS
|
||||||
@ -292,9 +292,6 @@ set(qpdf_resource_files
|
|||||||
"painting/qpdfa_metadata.xml"
|
"painting/qpdfa_metadata.xml"
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(painting/qdrawhelper.cpp # NO_PCH_SOURCES
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
if(WIN32 OR (UNIX AND NOT APPLE))
|
if(WIN32 OR (UNIX AND NOT APPLE))
|
||||||
set_target_properties(Gui PROPERTIES UNITY_BUILD OFF) # X11 define clashes/Windows oddities.
|
set_target_properties(Gui PROPERTIES UNITY_BUILD OFF) # X11 define clashes/Windows oddities.
|
||||||
endif()
|
endif()
|
||||||
|
@ -379,24 +379,23 @@ qt_internal_extend_target(Network CONDITION QNX PUBLIC_LIBRARIES socket) # speci
|
|||||||
|
|
||||||
qt_internal_extend_target(Network CONDITION SOLARIS PUBLIC_LIBRARIES socket nsl)
|
qt_internal_extend_target(Network CONDITION SOLARIS PUBLIC_LIBRARIES socket nsl)
|
||||||
|
|
||||||
if (WIN32)
|
qt_internal_extend_target(Network CONDITION WIN32
|
||||||
set_source_files_properties(Network # include windows.h (causing clashes with "interface" define)
|
NO_UNITY_BUILD_SOURCES
|
||||||
kernel/qauthenticator.cpp
|
kernel/qauthenticator.cpp
|
||||||
kernel/qdnslookup_win.cpp
|
kernel/qdnslookup_win.cpp
|
||||||
kernel/qhostaddress.cpp
|
kernel/qhostaddress.cpp
|
||||||
kernel/qhostinfo.cpp
|
kernel/qhostinfo.cpp
|
||||||
kernel/qhostinfo_win.cpp
|
kernel/qhostinfo_win.cpp
|
||||||
kernel/qnetconmonitor_win.cpp
|
kernel/qnetconmonitor_win.cpp
|
||||||
kernel/qnetworkinterface_win.cpp
|
kernel/qnetworkinterface_win.cpp
|
||||||
kernel/qnetworkproxy_win.cpp
|
kernel/qnetworkproxy_win.cpp
|
||||||
socket/qabstractsocket.cpp
|
socket/qabstractsocket.cpp
|
||||||
socket/qlocalserver.cpp
|
socket/qlocalserver.cpp
|
||||||
socket/qlocalserver_win.cpp
|
socket/qlocalserver_win.cpp
|
||||||
socket/qlocalsocket_win.cpp
|
socket/qlocalsocket_win.cpp
|
||||||
socket/qnativesocketengine.cpp
|
socket/qnativesocketengine.cpp
|
||||||
socket/qnativesocketengine_win.cpp
|
socket/qnativesocketengine_win.cpp
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# include the snippet projects for developer-builds
|
# include the snippet projects for developer-builds
|
||||||
if(QT_FEATURE_private_tests)
|
if(QT_FEATURE_private_tests)
|
||||||
|
@ -33,6 +33,8 @@ qt_internal_add_module(OpenGL
|
|||||||
qopenglvertexarrayobject.cpp qopenglvertexarrayobject.h qopenglvertexarrayobject_p.h
|
qopenglvertexarrayobject.cpp qopenglvertexarrayobject.h qopenglvertexarrayobject_p.h
|
||||||
qopenglwindow.cpp qopenglwindow.h
|
qopenglwindow.cpp qopenglwindow.h
|
||||||
qtopenglglobal.h
|
qtopenglglobal.h
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
qopengltextureblitter.cpp # qDebug()<< ambiguities
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_NO_FOREACH
|
QT_NO_FOREACH
|
||||||
QT_NO_USING_NAMESPACE
|
QT_NO_USING_NAMESPACE
|
||||||
@ -48,17 +50,14 @@ qt_internal_add_module(OpenGL
|
|||||||
GENERATE_CPP_EXPORTS
|
GENERATE_CPP_EXPORTS
|
||||||
)
|
)
|
||||||
|
|
||||||
# qDebug()<< ambiguities
|
|
||||||
set_source_files_properties(qopengltextureblitter.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set_source_files_properties(qopenglversionfunctionsfactory.cpp
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
qt_internal_extend_target(OpenGL CONDITION APPLE
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
qopenglversionfunctionsfactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
qt_internal_extend_target(OpenGL CONDITION QT_FEATURE_opengles2
|
qt_internal_extend_target(OpenGL CONDITION QT_FEATURE_opengles2
|
||||||
SOURCES
|
SOURCES
|
||||||
qopenglfunctions_es2.cpp qopenglfunctions_es2.h
|
qopenglfunctions_es2.cpp qopenglfunctions_es2.h
|
||||||
|
@ -59,7 +59,7 @@ qt_internal_extend_target(PrintSupport CONDITION MACOS
|
|||||||
${FWApplicationServices}
|
${FWApplicationServices}
|
||||||
Cups::Cups
|
Cups::Cups
|
||||||
NO_PCH_SOURCES
|
NO_PCH_SOURCES
|
||||||
"platform/macos/qcocoaprintersupport.mm"
|
platform/macos/qcocoaprintersupport.mm
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_internal_extend_target(PrintSupport CONDITION WIN32
|
qt_internal_extend_target(PrintSupport CONDITION WIN32
|
||||||
@ -74,13 +74,9 @@ qt_internal_extend_target(PrintSupport CONDITION WIN32
|
|||||||
comdlg32
|
comdlg32
|
||||||
winspool
|
winspool
|
||||||
NO_PCH_SOURCES
|
NO_PCH_SOURCES
|
||||||
"platform/windows/qwindowsprintersupport.cpp"
|
platform/windows/qwindowsprintersupport.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(platform/macos/qcocoaprintersupport.mm # NO_PCH_SOURCES
|
|
||||||
platform/windows/qwindowsprintersupport.cpp
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printpreviewwidget
|
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printpreviewwidget
|
||||||
SOURCES
|
SOURCES
|
||||||
kernel/qpaintengine_preview.cpp kernel/qpaintengine_preview_p.h
|
kernel/qpaintengine_preview.cpp kernel/qpaintengine_preview_p.h
|
||||||
@ -188,15 +184,14 @@ qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND UNIX
|
|||||||
dialogs/qprintpropertieswidget.ui
|
dialogs/qprintpropertieswidget.ui
|
||||||
dialogs/qprintsettingsoutput.ui
|
dialogs/qprintsettingsoutput.ui
|
||||||
dialogs/qprintwidget.ui
|
dialogs/qprintwidget.ui
|
||||||
|
NO_UNITY_BUILD_SOURCES
|
||||||
|
dialogs/qprintdialog_unix.cpp # Clashes with CUPS headers
|
||||||
INCLUDE_DIRECTORIES
|
INCLUDE_DIRECTORIES
|
||||||
${QtBase_SOURCE_DIR}/src/plugins/printsupport/cups
|
${QtBase_SOURCE_DIR}/src/plugins/printsupport/cups
|
||||||
ENABLE_AUTOGEN_TOOLS
|
ENABLE_AUTOGEN_TOOLS
|
||||||
uic
|
uic
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clashes with CUPS headers
|
|
||||||
set_source_files_properties(dialogs/qprintdialog_unix.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printpreviewdialog
|
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printpreviewdialog
|
||||||
SOURCES
|
SOURCES
|
||||||
dialogs/qprintpreviewdialog.cpp dialogs/qprintpreviewdialog.h
|
dialogs/qprintpreviewdialog.cpp dialogs/qprintpreviewdialog.h
|
||||||
|
@ -38,9 +38,6 @@ qt_internal_add_module(Sql
|
|||||||
GENERATE_CPP_EXPORTS
|
GENERATE_CPP_EXPORTS
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(compat/removed_api.cpp # NO_PCH_SOURCES
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
|
||||||
|
|
||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ qt_internal_add_module(Widgets
|
|||||||
GENERATE_CPP_EXPORTS
|
GENERATE_CPP_EXPORTS
|
||||||
)
|
)
|
||||||
|
|
||||||
if(APPLE)
|
qt_internal_extend_target(Widgets CONDITION APPLE
|
||||||
set_source_files_properties(kernel/qapplication.cpp
|
NO_UNITY_BUILD_SOURCES
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
kernel/qapplication.cpp
|
||||||
endif()
|
)
|
||||||
|
|
||||||
# Resources:
|
# Resources:
|
||||||
set(qstyle_resource_files
|
set(qstyle_resource_files
|
||||||
|
Loading…
Reference in New Issue
Block a user