diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2022-08-09 00:05:33 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-17 03:04:42 +0000 |
commit | 13bf20c8aa83db2599fc2a4b77e3bb09ccd0e409 (patch) | |
tree | b53ee3ad5b20272b6b7a62f1e11759e39538fc71 /cmake | |
parent | 51997a110c86f02c9a781264f560a81b9843d6bb (diff) | |
download | qtbase-13bf20c8aa83db2599fc2a4b77e3bb09ccd0e409.tar.gz |
wasm: include asyncify support unconditionally
Emscripten's option for enabling asyncify (-sASYNCIFY) is a link-time
option, which means there is no requirement to have a separate asyncify
build, at least for static builds.
Replace the current QT_HAVE_EMSCRIPTEN_ASYNCIFY compile-time option
with a run-time option which checks if the asyncify API is available.
Keep support for configuring with "-device-option QT_EMSCRIPTEN_ASYNCIFY=1"
for backwards compatibility and for the use case where want asyncify
support to be on by default for a given Qt build.
Enable asyncify for the asyncify_exec example.
Change-Id: I301fd7e2d3c0367532c886f4e34b23e1093646ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f347682fd52fd8e94f15a06cda9f1a64ebc4d552)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtWasmHelpers.cmake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake index ec0dd122e2..3e14ee6e74 100644 --- a/cmake/QtWasmHelpers.cmake +++ b/cmake/QtWasmHelpers.cmake @@ -72,9 +72,13 @@ function (qt_internal_setup_wasm_target_properties wasmTarget) set(QT_CFLAGS_OPTIMIZE_DEBUG "-Os" CACHE STRING INTERNAL FORCE) set(QT_FEATURE_optimize_debug ON CACHE BOOL INTERNAL FORCE) - target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ASYNCIFY" "-Os" "-s" "ASYNCIFY_IMPORTS=[qt_asyncify_suspend_js, qt_asyncify_resume_js]") + target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ASYNCIFY" "-Os") target_compile_definitions("${wasmTarget}" INTERFACE QT_HAVE_EMSCRIPTEN_ASYNCIFY) endif() + + # Set ASYNCIFY_IMPORTS unconditionally in order to support enabling asyncify at link time. + target_link_options("${wasmTarget}" INTERFACE "SHELL:-sASYNCIFY_IMPORTS=qt_asyncify_suspend_js,qt_asyncify_resume_js") + endfunction() function(qt_internal_wasm_add_finalizers target) |