wasm: add support for enabling Asyncify

./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 <lorn.potter@gmail.com>
This commit is contained in:
Morten Johan Sørvig 2020-02-13 11:16:36 +01:00
parent f7722394f4
commit 8a9ba8b2ce

View File

@ -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 \