summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-03-30 16:49:00 +0200
committerAmir Masoud Abdol <amir.abdol@qt.io>2023-04-03 12:41:14 +0200
commit7e074bd8a0d0137043cf43aa2473d0c3082fe3be (patch)
tree09f4cf0858a0f27602e35db4ffb5612bad63e12a /src
parentc19504e708bf099922180ab99f3cf4b94d91fc7e (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/CMakeLists.txt54
-rw-r--r--src/gui/CMakeLists.txt5
-rw-r--r--src/network/CMakeLists.txt35
-rw-r--r--src/opengl/CMakeLists.txt15
-rw-r--r--src/printsupport/CMakeLists.txt13
-rw-r--r--src/sql/CMakeLists.txt3
-rw-r--r--src/widgets/CMakeLists.txt8
7 files changed, 57 insertions, 76 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index ee701a2c63..d3d977498f 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -315,6 +315,13 @@ qt_internal_add_module(Core
# despite the fact that appropriate checks are in place to avoid that!
tools/qshareddata.cpp tools/qshareddata.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
QT_NO_FOREACH
QT_NO_USING_NAMESPACE
@@ -342,15 +349,6 @@ qt_internal_add_module(Core
)
_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)
if (NOT QT_NAMESPACE STREQUAL "")
@@ -523,7 +521,6 @@ qt_internal_extend_target(Core CONDITION WIN32
kernel/qwinregistry.cpp kernel/qwinregistry_p.h
plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h
thread/qthread_win.cpp
- # DEFINES # special case: remove
LIBRARIES
advapi32
authz
@@ -541,6 +538,19 @@ qt_internal_extend_target(Core CONDITION WIN32
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)
### Qt7: remove
# 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
../3rdparty/forkfd/forkfd.h
io/forkfd_qt.cpp
+ NO_UNITY_BUILD_SOURCES
+ io/forkfd_qt.cpp # EINTR_LOOP macro clashes
INCLUDE_DIRECTORIES
../3rdparty/forkfd
)
@@ -1115,6 +1127,8 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_cborstreamreader
qt_internal_extend_target(Core CONDITION QT_FEATURE_cborstreamwriter
SOURCES
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
@@ -1295,31 +1309,11 @@ set_source_files_properties(
thread/qmutex_unix.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.
if(WIN32)
get_target_property(defines Core COMPILE_DEFINITIONS)
list(REMOVE_ITEM defines QT_NO_CAST_TO_ASCII)
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()
qt_internal_apply_gc_binaries_conditional(Core PUBLIC)
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 3fd28d2a01..b6ecc5f333 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -275,7 +275,7 @@ qt_internal_add_module(Gui
PRIVATE_MODULE_INTERFACE
Qt::CorePrivate
NO_PCH_SOURCES
- "painting/qdrawhelper.cpp"
+ painting/qdrawhelper.cpp
PRECOMPILED_HEADER
"kernel/qt_gui_pch.h"
GENERATE_CPP_EXPORTS
@@ -292,9 +292,6 @@ set(qpdf_resource_files
"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))
set_target_properties(Gui PROPERTIES UNITY_BUILD OFF) # X11 define clashes/Windows oddities.
endif()
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 69043b006a..789f04c123 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -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)
-if (WIN32)
- set_source_files_properties(Network # include windows.h (causing clashes with "interface" define)
- kernel/qauthenticator.cpp
- kernel/qdnslookup_win.cpp
- kernel/qhostaddress.cpp
- kernel/qhostinfo.cpp
- kernel/qhostinfo_win.cpp
- kernel/qnetconmonitor_win.cpp
- kernel/qnetworkinterface_win.cpp
- kernel/qnetworkproxy_win.cpp
- socket/qabstractsocket.cpp
- socket/qlocalserver.cpp
- socket/qlocalserver_win.cpp
- socket/qlocalsocket_win.cpp
- socket/qnativesocketengine.cpp
- socket/qnativesocketengine_win.cpp
- PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
-endif()
+qt_internal_extend_target(Network CONDITION WIN32
+ NO_UNITY_BUILD_SOURCES
+ kernel/qauthenticator.cpp
+ kernel/qdnslookup_win.cpp
+ kernel/qhostaddress.cpp
+ kernel/qhostinfo.cpp
+ kernel/qhostinfo_win.cpp
+ kernel/qnetconmonitor_win.cpp
+ kernel/qnetworkinterface_win.cpp
+ kernel/qnetworkproxy_win.cpp
+ socket/qabstractsocket.cpp
+ socket/qlocalserver.cpp
+ socket/qlocalserver_win.cpp
+ socket/qlocalsocket_win.cpp
+ socket/qnativesocketengine.cpp
+ socket/qnativesocketengine_win.cpp
+)
# include the snippet projects for developer-builds
if(QT_FEATURE_private_tests)
diff --git a/src/opengl/CMakeLists.txt b/src/opengl/CMakeLists.txt
index 1729f1b12d..9cba766d10 100644
--- a/src/opengl/CMakeLists.txt
+++ b/src/opengl/CMakeLists.txt
@@ -33,6 +33,8 @@ qt_internal_add_module(OpenGL
qopenglvertexarrayobject.cpp qopenglvertexarrayobject.h qopenglvertexarrayobject_p.h
qopenglwindow.cpp qopenglwindow.h
qtopenglglobal.h
+ NO_UNITY_BUILD_SOURCES
+ qopengltextureblitter.cpp # qDebug()<< ambiguities
DEFINES
QT_NO_FOREACH
QT_NO_USING_NAMESPACE
@@ -48,17 +50,14 @@ qt_internal_add_module(OpenGL
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:
#####################################################################
+qt_internal_extend_target(OpenGL CONDITION APPLE
+ NO_UNITY_BUILD_SOURCES
+ qopenglversionfunctionsfactory.cpp
+)
+
qt_internal_extend_target(OpenGL CONDITION QT_FEATURE_opengles2
SOURCES
qopenglfunctions_es2.cpp qopenglfunctions_es2.h
diff --git a/src/printsupport/CMakeLists.txt b/src/printsupport/CMakeLists.txt
index 330f44c689..1ff5fd552f 100644
--- a/src/printsupport/CMakeLists.txt
+++ b/src/printsupport/CMakeLists.txt
@@ -59,7 +59,7 @@ qt_internal_extend_target(PrintSupport CONDITION MACOS
${FWApplicationServices}
Cups::Cups
NO_PCH_SOURCES
- "platform/macos/qcocoaprintersupport.mm"
+ platform/macos/qcocoaprintersupport.mm
)
qt_internal_extend_target(PrintSupport CONDITION WIN32
@@ -74,13 +74,9 @@ qt_internal_extend_target(PrintSupport CONDITION WIN32
comdlg32
winspool
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
SOURCES
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/qprintsettingsoutput.ui
dialogs/qprintwidget.ui
+ NO_UNITY_BUILD_SOURCES
+ dialogs/qprintdialog_unix.cpp # Clashes with CUPS headers
INCLUDE_DIRECTORIES
${QtBase_SOURCE_DIR}/src/plugins/printsupport/cups
ENABLE_AUTOGEN_TOOLS
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
SOURCES
dialogs/qprintpreviewdialog.cpp dialogs/qprintpreviewdialog.h
diff --git a/src/sql/CMakeLists.txt b/src/sql/CMakeLists.txt
index e69df530a9..a7e139655a 100644
--- a/src/sql/CMakeLists.txt
+++ b/src/sql/CMakeLists.txt
@@ -38,9 +38,6 @@ qt_internal_add_module(Sql
GENERATE_CPP_EXPORTS
)
-set_source_files_properties(compat/removed_api.cpp # NO_PCH_SOURCES
- PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
-
## Scopes:
#####################################################################
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 417f6a2d8e..39c197eeba 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -68,10 +68,10 @@ qt_internal_add_module(Widgets
GENERATE_CPP_EXPORTS
)
-if(APPLE)
- set_source_files_properties(kernel/qapplication.cpp
- PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
-endif()
+qt_internal_extend_target(Widgets CONDITION APPLE
+ NO_UNITY_BUILD_SOURCES
+ kernel/qapplication.cpp
+)
# Resources:
set(qstyle_resource_files