diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2023-10-23 22:29:44 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2023-12-20 00:44:28 +0000 |
commit | c6d3b91549ceaafa81cbcedf243f798f1114a467 (patch) | |
tree | 274701e4b5ec616688632790b902c2657172025b | |
parent | db93cd4f61ec9ad75b2389e5ac1724becfce3a1b (diff) |
wasm: set MAXIMUM_MEMORY to 4GB
This increases the maximum available memory from 2GB
(Emscritpten default) to 4GB, which is the 32-bit wasm
max.
Add QT_WASM_MAXIMUM_MEMORY qmake/cmake option for overriding.
Pick-to: 6.7
Change-Id: I6257fc919a749412c4ba1e0f939996c6057ce314
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | mkspecs/features/wasm/wasm.prf | 6 | ||||
-rw-r--r-- | src/corelib/Qt6WasmMacros.cmake | 9 | ||||
-rw-r--r-- | src/corelib/doc/src/cmake/cmake-properties.qdoc | 23 |
3 files changed, 38 insertions, 0 deletions
diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf index f1859aee41..c1a1a3a73e 100644 --- a/mkspecs/features/wasm/wasm.prf +++ b/mkspecs/features/wasm/wasm.prf @@ -48,6 +48,12 @@ exists($$QMAKE_QT_CONFIG) { INITIAL_MEMORY = $$QT_WASM_INITIAL_MEMORY } EMCC_LFLAGS += -s INITIAL_MEMORY=$$INITIAL_MEMORY + isEmpty(QT_WASM_MAXIMUM_MEMORY) { + MAXIMUM_MEMORY = 4GB # 32-bit max + } else { + MAXIMUM_MEMORY = $$QT_WASM_MAXIMUM_MEMORY + } + EMCC_LFLAGS += -s MAXIMUM_MEMORY=$$MAXIMUM_MEMORY qtConfig(sse2) { QMAKE_CFLAGS += -O2 -msimd128 -msse -msse2 diff --git a/src/corelib/Qt6WasmMacros.cmake b/src/corelib/Qt6WasmMacros.cmake index 5fd76e8536..1de6e5448c 100644 --- a/src/corelib/Qt6WasmMacros.cmake +++ b/src/corelib/Qt6WasmMacros.cmake @@ -91,6 +91,15 @@ function(_qt_internal_wasm_add_target_helpers target) endif() target_link_options("${target}" PRIVATE "SHELL:-s INITIAL_MEMORY=${QT_WASM_INITIAL_MEMORY}") + # Set maximum memory size, either from user setting or to 4GB (the 32-bit maximum) + get_target_property(_tmp_maximumMemory "${target}" QT_WASM_MAXIMUM_MEMORY) + if(_tmp_maximumMemory) + set(QT_WASM_MAXIMUM_MEMORY "${_tmp_maximumMemory}") + elseif(NOT DEFINED QT_WASM_MAXIMUM_MEMORY) + set(QT_WASM_MAXIMUM_MEMORY "4GB") + endif() + target_link_options("${target}" PRIVATE "SHELL:-s MAXIMUM_MEMORY=${QT_WASM_MAXIMUM_MEMORY}") + endif() endfunction() diff --git a/src/corelib/doc/src/cmake/cmake-properties.qdoc b/src/corelib/doc/src/cmake/cmake-properties.qdoc index 8f21e56be1..54438bc6b1 100644 --- a/src/corelib/doc/src/cmake/cmake-properties.qdoc +++ b/src/corelib/doc/src/cmake/cmake-properties.qdoc @@ -592,6 +592,29 @@ For more information, see \l{https://github.com/emscripten-core/emscripten/blob/ */ /*! +\page cmake-target-property-qt-wasm-maximum-memory.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_WASM_MAXIMUM_MEMORY +\target cmake-target-property-QT_WASM_MAXIMUM_MEMORY + +\summary {Internal WebAssembly maximum memory.} + +\cmakepropertysince 6.7 +\preliminarycmakeproperty +\cmakepropertywebassemblyonly + +Specifies the maximum amount of memory the applicataion can use. Translates into +the Emscripten compiler setting of MAXIMUM_MEMORY. The default value +is 4GB, which is the maximum for 32-bit WebAssembly. + +For more information, see \l{https://github.com/emscripten-core/emscripten/blob/main/src/settings.js}{Emscripten compiler settings}. +*/ + + + +/*! \page cmake-target-property-qt-ios-launch-screen.html \ingroup cmake-properties-qtcore \ingroup cmake-target-properties-qtcore |