wasm: allow setting total memory for non thread builds
Using WASM_OBJECT_FILES does not allow memory growth, so we need to just explicitly check for QMAKE_WASM_TOTAL_MEMORY Change-Id: I447113972dfc3df4ee4073e8cc25481646d1507b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
d5c684c3c3
commit
987cca7bca
@ -6,16 +6,6 @@ exists($$QMAKE_QT_CONFIG) {
|
|||||||
qtConfig(thread) {
|
qtConfig(thread) {
|
||||||
|
|
||||||
EMCC_THREAD_LFLAGS += -s USE_PTHREADS=1
|
EMCC_THREAD_LFLAGS += -s USE_PTHREADS=1
|
||||||
# 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.
|
|
||||||
TOTAL_MEMORY = 1GB
|
|
||||||
!isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
|
||||||
TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY
|
|
||||||
}
|
|
||||||
|
|
||||||
message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY)
|
|
||||||
EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY
|
|
||||||
|
|
||||||
# Create worker threads at startup. This is supposed to be an optimization,
|
# Create worker threads at startup. This is supposed to be an optimization,
|
||||||
# however exceeding the pool size has been obesverved to hang the application.
|
# however exceeding the pool size has been obesverved to hang the application.
|
||||||
@ -29,6 +19,20 @@ exists($$QMAKE_QT_CONFIG) {
|
|||||||
} else {
|
} else {
|
||||||
EMCC_THREAD_LFLAGS += -s ALLOW_MEMORY_GROWTH=1
|
EMCC_THREAD_LFLAGS += -s ALLOW_MEMORY_GROWTH=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qtConfig(thread) | !isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
# QMAKE_WASM_TOTAL_MEMORY must be a multiple of 64KB
|
||||||
|
TOTAL_MEMORY = 1GB
|
||||||
|
!isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
|
||||||
|
TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY
|
||||||
|
}
|
||||||
|
message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY)
|
||||||
|
EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY
|
||||||
|
}
|
||||||
QMAKE_LFLAGS += $$EMCC_THREAD_LFLAGS
|
QMAKE_LFLAGS += $$EMCC_THREAD_LFLAGS
|
||||||
QMAKE_LFLAGS_DEBUG += $$EMCC_THREAD_LFLAGS
|
QMAKE_LFLAGS_DEBUG += $$EMCC_THREAD_LFLAGS
|
||||||
QMAKE_CFLAGS += $$EMCC_THREAD_LFLAGS
|
QMAKE_CFLAGS += $$EMCC_THREAD_LFLAGS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user