diff options
Diffstat (limited to 'src/corelib/Qt6WasmMacros.cmake')
-rw-r--r-- | src/corelib/Qt6WasmMacros.cmake | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/Qt6WasmMacros.cmake b/src/corelib/Qt6WasmMacros.cmake index 86044d7e02..8f9720653b 100644 --- a/src/corelib/Qt6WasmMacros.cmake +++ b/src/corelib/Qt6WasmMacros.cmake @@ -30,23 +30,25 @@ function(_qt_internal_wasm_add_target_helpers target) message(DEBUG "Setting PTHREAD_POOL_SIZE to ${POOL_SIZE} for ${target}") endif() - # Hardcode wasm memory size. Emscripten does not currently support memory growth - # (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) + # Hardcode wasm memory size. get_target_property(_tmp_initialMemory "${target}" QT_WASM_INITIAL_MEMORY) if(_tmp_initialMemory) set(QT_WASM_INITIAL_MEMORY "${_tmp_initialMemory}") elseif(NOT DEFINED QT_WASM_INITIAL_MEMORY) if(QT_FEATURE_thread) + # Pthreads and ALLOW_MEMORY_GROWTH can cause javascript wasm memory access to + # be slow and having to update HEAP* views. Instead, we specify the memory size + # at build time. Further, browsers limit the maximum initial memory size to 1GB. + # https://github.com/WebAssembly/design/issues/1271 set(QT_WASM_INITIAL_MEMORY "1GB") else() # emscripten default is 16MB, we need slightly more sometimes - set(QT_WASM_INITIAL_MEMORY "20MB") + set(QT_WASM_INITIAL_MEMORY "50MB") endif() endif() if(DEFINED QT_WASM_INITIAL_MEMORY) + # QT_WASM_INITIAL_MEMORY must be a multiple of 65536 target_link_options("${target}" PRIVATE "SHELL:-s INITIAL_MEMORY=${QT_WASM_INITIAL_MEMORY}") message(DEBUG "-- Setting INITIAL_MEMORY to ${QT_WASM_INITIAL_MEMORY} for ${target}") |