From 8a9ba8b2ce7c32b7e08560f56e4243f856dad1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 13 Feb 2020 11:16:36 +0100 Subject: wasm: add support for enabling Asyncify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ./configure […] --device-option EMSCRIPTEN_ASYNCIFY=1 Set QT_HAVE_EMSCRIPTEN_ASYNCIFY as a feature flag, enable optimizations for asyncified debug builds. Change-Id: I81c887a411780e328aed48ec09ff6b9277c3bccf Reviewed-by: Lorn Potter --- mkspecs/wasm-emscripten/qmake.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mkspecs/wasm-emscripten') diff --git a/mkspecs/wasm-emscripten/qmake.conf b/mkspecs/wasm-emscripten/qmake.conf index 82c02c76e7..18562621ac 100644 --- a/mkspecs/wasm-emscripten/qmake.conf +++ b/mkspecs/wasm-emscripten/qmake.conf @@ -8,6 +8,23 @@ include(../common/clang.conf) load(device_config) load(emcc_ver) +# Support enabling asyncify by configuring with "-device-option EMSCRIPTEN_ASYNCIFY=1" +!isEmpty(EMSCRIPTEN_ASYNCIFY): { + !equals(EMSCRIPTEN_ASYNCIFY, 1):!equals(EMSCRIPTEN_ASYNCIFY, 0): \ + message(Error: The value for EMSCRIPTEN_ASYNCIFY must be 0 or 1) + equals(EMSCRIPTEN_ASYNCIFY, 1): { + QMAKE_CFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY + QMAKE_CXXFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY + QMAKE_LFLAGS += -s ASYNCIFY + + # 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 + # are omitted. Enable optimizations also for debug builds. + QMAKE_LFLAGS_DEBUG += -Os + } +} + EMTERP_FLAGS = \ -s EMTERPRETIFY=1 \ -s EMTERPRETIFY_ASYNC=1 \ -- cgit v1.2.3