summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2022-11-07 18:47:12 +0100
committerDavid Skoland <david.skoland@qt.io>2022-11-24 18:49:40 +0100
commitef7d17ed159600d54c211ade656285eaf095f155 (patch)
tree57ef286e86b25750023d21f5f7d528d83c159dc3
parent770c849a31266beeb1b71f390d8119a0504d8ce6 (diff)
wasm: Enable asyncify for tests
Since a good number of tests use exec and friends, we want to use asyncify for them. Asyncify is still possible to enable universally with device options. Change-Id: I0916f55328c98f2ba179cda3757eeee9d27f3e47 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--cmake/QtTestHelpers.cmake5
-rw-r--r--cmake/QtWasmHelpers.cmake1
2 files changed, 5 insertions, 1 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 43b75768f0..e08ba7c8e6 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -558,6 +558,11 @@ function(qt_internal_add_test name)
# TODO: Add functionality to specify browser
list(APPEND extra_test_args "--browser=chrome")
+ # We always want to enable asyncify for tests, as some of them use exec
+ # Optimize for size (-Os), since asyncify tends to make the resulting
+ # binary very large
+ target_link_options("${name}" PRIVATE "SHELL:-s ASYNCIFY" "-Os")
+
# This tells cmake to run the tests with this script, since wasm files can't be
# executed directly
set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun")
diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake
index 7ba7cd893a..5e42c526a7 100644
--- a/cmake/QtWasmHelpers.cmake
+++ b/cmake/QtWasmHelpers.cmake
@@ -70,7 +70,6 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
# target_link_options("${wasmTarget}" INTERFACE "SHELL:-s SOCKET_DEBUG") # print out socket,network data transfer
if ("QT_EMSCRIPTEN_ASYNCIFY=1" IN_LIST QT_QMAKE_DEVICE_OPTIONS)
-
# Emscripten recommends building with optimizations when using asyncify
# in order to reduce wasm file size, and may also generate broken wasm
# (with "wasm validation error: too many locals" type errors) if optimizations