From f4228163fb8f0f7e257aa6e824c2387cf0a6370e Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Thu, 9 Mar 2023 15:04:19 +0100 Subject: [PATCH] Exclude a few source files from QtCore On macOS, if QtCore is built with unity build, tst_qmakelib will fail. For now, we decided to exclude the qsystemerror.cpp on macOS. The _DARWIN_C_SOURCE provides a few necessary macros on macOS. By defining the macro we can include the qfilesystemengine_unix.cpp and qlockfile_unix.cpp into the unity build again. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I2c8b38b0512792c21966582c33471b7ee222617a Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- src/corelib/CMakeLists.txt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 09ed1f9e77c..abc4058bf39 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -310,6 +310,11 @@ qt_internal_add_module(Core tools/qvarlengtharray.h tools/qvector.h tools/qversionnumber.cpp tools/qversionnumber.h + NO_UNITY_BUILD_SOURCES + # MinGW complains about `free-nonheap-object` in ~QSharedDataPointer() + # despite the fact that appropriate checks are in place to avoid that! + tools/qshareddata.cpp tools/qshareddata.h + text/qlocale.cpp text/qlocale.h DEFINES QT_NO_FOREACH QT_NO_USING_NAMESPACE @@ -563,6 +568,15 @@ qt_internal_extend_target(Core CONDITION APPLE ${FWFoundation} PUBLIC_LIBRARIES ${FWIOKit} + DEFINES + _DARWIN_C_SOURCE # This resolves two issues, + # - Provide DT_* macros to qfilesystemengine_unix.cpp + # - Enables SOCK_MAXADDRLEN in case its missing during the unity build + NO_UNITY_BUILD_SOURCES + kernel/qsystemerror.cpp + # This makes sure that the tst_qmakelib passes. For some reason, + # QtCore ends up returning a corrupted error message in + # write_file(): fail ) qt_internal_extend_target(Core CONDITION MACOS @@ -627,12 +641,6 @@ qt_internal_extend_target(Core CONDITION UNIX thread/qthread_unix.cpp ) -qt_internal_extend_target(Core CONDITION APPLE - NO_UNITY_BUILD_SOURCES - io/qfilesystemengine_unix.cpp # avoid undefined DT_* macros - io/qlockfile_unix.cpp # avoid undefined SOCK_MAXADDRLEN (in proc_info.h) -) - qt_internal_extend_target(Core CONDITION QT_FEATURE_thread SOURCES thread/qatomic.cpp