wasm: add macro for for emscritpen::async()

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 <lorn.potter@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This commit is contained in:
Morten Sørvig 2024-11-26 15:18:18 +01:00
parent 92ad0f1f01
commit 16fdbbf444

View File

@ -34,6 +34,12 @@
#include <emscripten/threading.h>
#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;