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 <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Amir Masoud Abdol 2023-03-09 15:04:19 +01:00
parent 3e9f2a0adb
commit f4228163fb

View File

@ -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