summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-05-10 09:09:51 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2022-05-12 16:34:24 +0200
commitb119f26a5663c5e3f82d82ad41e479a42115d954 (patch)
tree99f07f2df890ed6cfb926fc0934b8235dbfbdf18
parentbd8d3fb47ca685da9ce038bd6c6ee66e49ec9317 (diff)
wasm: enable WASM_BIGINT
JavaScripts's BigInt feature provides support for arbitrary-precision integers. This makes it possible to represent 64-bit integers; the standard JS Number type supports 32-bit integers only (or more accurately 53-bit integers - see Number.MAX_SAFE_INTEGER). Enable WASM_BIGINT which makes Emscripten map int64_t and uint64_t to BigInt when interfacing with JavaScript code. This removes one of the conditions which enables wasm-emscripten-finalize. Task-number: QTBUG-103352 Change-Id: Ia70d599daaf34c92695f5a2b61665e0c237e6b95 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
-rw-r--r--cmake/QtWasmHelpers.cmake3
-rw-r--r--mkspecs/wasm-emscripten/qmake.conf3
2 files changed, 4 insertions, 2 deletions
diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake
index 77c77d2882..5e09feac29 100644
--- a/cmake/QtWasmHelpers.cmake
+++ b/cmake/QtWasmHelpers.cmake
@@ -7,7 +7,8 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
"SHELL:-s EXPORTED_RUNTIME_METHODS=[UTF16ToString,stringToUTF16,specialHTMLTargets]"
"SHELL:-s USE_WEBGL2=1"
"--bind"
- "SHELL:-s FETCH=1")
+ "SHELL:-s FETCH=1"
+ "SHELL:-s WASM_BIGINT=1")
# Enable MODULARIZE and set EXPORT_NAME, which makes it possible to
# create application instances using a global constructor function,
diff --git a/mkspecs/wasm-emscripten/qmake.conf b/mkspecs/wasm-emscripten/qmake.conf
index 270ab39559..140f2b4801 100644
--- a/mkspecs/wasm-emscripten/qmake.conf
+++ b/mkspecs/wasm-emscripten/qmake.conf
@@ -38,7 +38,8 @@ EMCC_COMMON_LFLAGS += \
--bind \
-s FETCH=1 \
-s MODULARIZE=1 \
- -s EXPORT_NAME=createQtAppInstance
+ -s EXPORT_NAME=createQtAppInstance \
+ -s WASM_BIGINT=1
# The -s arguments can also be used with release builds,
# but are here in debug for clarity.