From ef7d17ed159600d54c211ade656285eaf095f155 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Mon, 7 Nov 2022 18:47:12 +0100 Subject: [PATCH] wasm: Enable asyncify for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmake/QtTestHelpers.cmake | 5 +++++ cmake/QtWasmHelpers.cmake | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 43b75768f04..e08ba7c8e62 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 7ba7cd893ac..5e42c526a74 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