From 16fdbbf444aa828795e3b0cd6d420eaa16540b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Tue, 26 Nov 2024 15:18:18 +0100 Subject: [PATCH] wasm: add macro for for emscritpen::async() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit emscritpen:async() needs to be passed to embind exported functions, if that function might suspend, and if JSPI is enabled (and only if JSPI is enabled): emscripten::function("fn", &fn, emscritpen:async()); Add QT_WASM_EMSCRIPTEN_ASYNC macro which evaluates to ",emscritpen::async()" (note comma) if JSPI is enabled, and to nothing if not. emscripten::function("fn", &fn QT_WASM_EMSCRIPTEN_ASYNC); This way we can configure Qt for either JSPI and non-jspi builds. Incidentally the emscritpen::async() requirement makes JSPI a Qt configure time feature, instead of an app link time feature like for the current ASYNCIFY (1) support. Task-number: QTBUG-129749 Change-Id: I5bf820242c19a26018f4a3e06ee570e2d36ed993 Reviewed-by: Lorn Potter Reviewed-by: Piotr WierciƄski --- src/corelib/platform/wasm/qstdweb_p.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/platform/wasm/qstdweb_p.h b/src/corelib/platform/wasm/qstdweb_p.h index c15324fdc27..5cb5db1f549 100644 --- a/src/corelib/platform/wasm/qstdweb_p.h +++ b/src/corelib/platform/wasm/qstdweb_p.h @@ -34,6 +34,12 @@ #include #endif // #if QT_CONFIG(thread) +#if QT_CONFIG(wasm_jspi) +# define QT_WASM_EMSCRIPTEN_ASYNC ,emscripten::async() +#else +# define QT_WASM_EMSCRIPTEN_ASYNC +#endif + QT_BEGIN_NAMESPACE class QMimeData;