From 234f03a0b3d387447ccd5546697ef58338710554 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Mon, 31 Jul 2023 15:42:35 +0200 Subject: [PATCH] Remove the unix dispatcher from WASM builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unix dispatcher is not used and - as such - redundant on WASM. Change-Id: Ia8789ef783b06ce9cfba2ce9d67159db2355b594 Reviewed-by: MikoĊ‚aj Boc --- src/corelib/CMakeLists.txt | 6 +++++- src/corelib/kernel/qcoreapplication.cpp | 4 +++- src/corelib/thread/qthread_unix.cpp | 4 +++- src/gui/CMakeLists.txt | 2 +- src/plugins/platforms/wasm/qwasmintegration.cpp | 3 --- tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 6 ++++-- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index e7545084c1..f5c4ef6e7d 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -659,12 +659,16 @@ qt_internal_extend_target(Core CONDITION UNIX io/qfsfileengine_unix.cpp io/qlockfile_unix.cpp kernel/qcore_unix.cpp kernel/qcore_unix_p.h - kernel/qeventdispatcher_unix.cpp kernel/qeventdispatcher_unix_p.h kernel/qpoll_p.h kernel/qtimerinfo_unix.cpp kernel/qtimerinfo_unix_p.h thread/qthread_unix.cpp ) +qt_internal_extend_target(Core CONDITION UNIX AND NOT WASM + SOURCES + kernel/qeventdispatcher_unix.cpp kernel/qeventdispatcher_unix_p.h +) + qt_internal_extend_target(Core CONDITION QT_FEATURE_thread SOURCES thread/qatomic.cpp diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 297d721d53..eb1e9dac39 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -56,7 +56,9 @@ # include "qeventdispatcher_glib_p.h" # endif # endif -# include "qeventdispatcher_unix_p.h" +# if !defined(Q_OS_WASM) +# include "qeventdispatcher_unix_p.h" +# endif #endif #ifdef Q_OS_WIN #include "qeventdispatcher_win_p.h" diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index ee66e1c3c3..b0088d4ce0 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -20,7 +20,9 @@ # endif #endif -#include +#if !defined(Q_OS_WASM) +# include +#endif #include "qthreadstorage.h" diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 8c7fd791cd..a733e88645 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -920,7 +920,7 @@ qt_internal_extend_target(Gui CONDITION WASM platform/wasm/qwasmlocalfileaccess.cpp platform/wasm/qwasmlocalfileaccess_p.h ) -qt_internal_extend_target(Gui CONDITION UNIX +qt_internal_extend_target(Gui CONDITION UNIX AND NOT WASM SOURCES platform/unix/qgenericunixeventdispatcher.cpp platform/unix/qgenericunixeventdispatcher_p.h platform/unix/qunixeventdispatcher.cpp diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index c8f5072cb8..473df5f66d 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -14,9 +14,6 @@ #include "qwasmwindow.h" #include "qwasmbackingstore.h" #include "qwasmfontdatabase.h" -#if defined(Q_OS_UNIX) -#include -#endif #include #include #include diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 16437d39f9..171f95157d 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -9,7 +9,9 @@ #include #include #if defined(Q_OS_UNIX) - #include + #if !defined(Q_OS_WASM) + #include + #endif #include #if defined(HAVE_GLIB) #include @@ -486,7 +488,7 @@ void tst_QEventLoop::processEventsExcludeTimers() // but not if we exclude timers eventLoop.processEvents(QEventLoop::X11ExcludeTimers); -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher(); if (!qobject_cast(eventDispatcher) #if defined(HAVE_GLIB)