wasm: increase default initial memory

Some apps may need more initial memory when linking, emscripten will
fail with:
wasm-ld: error: initial memory too small

This increases the default initial memory form 16MB to 20MB.

Larger apps might still get this error, in which case
QT_WASM_INITIAL_MEMORY can be set.

Pick-to: 6.2
Fixes: QTBUG-97457
Change-Id: Icdc56c41fb3a3852a9a83f7a3dc15820e83e1148
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2021-10-19 16:03:21 +10:00
parent 873edc0f15
commit 2148e1f0e6

View File

@ -28,8 +28,12 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
# (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size
# at build time. Further, browsers limit the maximum initial memory size to 1GB.
# QT_WASM_INITIAL_MEMORY must be a multiple of 64KB (i.e. 65536)
if(NOT DEFINED QT_WASM_INITIAL_MEMORY AND QT_FEATURE_thread)
set(QT_WASM_INITIAL_MEMORY "1GB")
if(NOT DEFINED QT_WASM_INITIAL_MEMORY)
if(QT_FEATURE_thread)
set(QT_WASM_INITIAL_MEMORY "1GB")
else()
set(QT_WASM_INITIAL_MEMORY "20MB") # emscripten default is 16MB, we need slightly more sometimes
endif()
endif()
if(DEFINED QT_WASM_INITIAL_MEMORY)