summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/wasm
Commit message (Collapse)AuthorAgeFilesLines
* wasm: update Emscripten to 3.1.50Lorn Potter2024-02-211-1/+1
| | | | | | Pick-to: 6.7 Change-Id: Id147a927420a1743ef1cfd952b36e90ac0c319dd Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: set MAXIMUM_MEMORY to 4GBMorten Sørvig2023-12-201-0/+6
| | | | | | | | | | | | 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>
* wasm: Don't suppress exceptions during main()Morten Sørvig2023-12-201-2/+2
| | | | | | | | | | | | | | | | | If there's e.g. an infinite loop during main() that would previously result in a blank page, but not error message. The expected case is that we would get a RangeError exception, but that exception never reaches the catch handlers in qtloader.js. Work around this by setting noInitialRun, followed by calling main manually. We then need to handle the case where the app.exec() workaround throws, which should not trigger an error. Pick-to: 6.7 Change-Id: Ia8431279308770981316cd168e4316341bfb2531 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Support PRELOAD var substitution for WASM main html with qmakeMikolaj Boc2023-07-271-1/+6
| | | | | | | | | | The PRELOAD variable in wasm_shell.html wouldn't get substituted with preload list when using qmake. Do that as it is done in cmake. Fixes: QTBUG-115507 Change-Id: I3c659626dc6fa6f4fdf9e31bd62b87fc6a7d8bbe Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* Use a sanitized JS export name for WASM modules (qmake)Mikolaj Boc2023-07-271-2/+4
| | | | | | | | | | | | | Previously, a target name with a JS special character (like, -, for example), would lead to an invalid export name being generated for WASM modules. Sanitize these by replacing any non-alphanumeric character with underscores, as is done for feature names. This is a qmake version of 58a47edda15fe365220f8502ad42a7bd09bf83b7 Fixes: QTBUG-115506 Change-Id: I7c84076be54da91cf0f707c1613afc382acdcb83 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* wasm: update emscripten to 3.1.37Piotr Wierciński2023-06-261-1/+1
| | | | | | | | Qt 6.6 will require emscripten 3.1.37 Pick-to: 6.6 Change-Id: Id036d799d5730ac8d8a5f7914d56a1ed421f9222 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* Make WASM export names different across modulesMikolaj Boc2023-06-201-0/+7
| | | | | | | | The export name is now ${TARGET_NAME}Entry. This can also be overridden by using QT_WASM_EXPORT_NAME, both in CMake and qmake Change-Id: I59c97ae6e22f0b2720716e9d7eff7b6b13d37ab5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: add "FS" to EXPORTED_METHODSMorten Sørvig2023-06-201-2/+2
| | | | | | | | | This is required when using the preload functionality from qtloader. Pick-to: 6.6 Change-Id: Ib1bf8788b87834ba0ff80d563897040e093a16b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* wasm: Flesh out side module and main module logic for shared buildsTor Arne Vestbø2023-01-021-0/+11
| | | | | | Task-number: QTBUG-63925 Change-Id: I9da8ca0364a4fe6c9ec4d272657e1cf726d305c4 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: update emscripten to 3.1.25Morten Sørvig2022-12-281-1/+1
| | | | | | | | | | | | Qt 6.5 will require emscripten 3.1.25. This is not the most recent version (3.1.27 at the time of writing), however .26 and .27 make changes to stack layout and size which require further investigation. Change-Id: Ibe285ef160d450d6b2c63a7fb71d3561b0032e37 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: Fix qmake buildMorten Sørvig2022-12-091-2/+2
| | | | | | | | | | Add missing '\' on multiline variable assignment. Sync EXPORTED_METHODS with cmake build. Change-Id: I8c790c5f8a7bdae75d6b3e3d6e4482f6c69ecbe8 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* wasm: set ALLOW_MEMORY_GROWTH for multi-threaded buildsMorten Sørvig2022-09-011-16/+3
| | | | | | | | | | | | | | | | | | | | Unify the settings for single-threaded and multi-threaded builds; Qt now always enables heap growth by default. This means we don't have to reserve a large (1GB) fixed memory size, but can instead set the smaller (50 MB) initial memory size, like the single-threaded build does. Enabling threads + memory growth can potentially cause a performance regression when accessing heap memory from JavaScript (https://github.com/WebAssembly/design/issues/1271). We leave it for the application to decide if this applies, and if the switch to fixed memory should be made. Change-Id: I96988b072506456685086e55aca4007a146bd70f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: update emsdk to 3.1.14Lorn Potter2022-08-301-1/+1
| | | | | | | | | This fixes some threading bugs Pick-to: 6.4 Change-Id: I1a96dcc54d8338de09b551d52a166d073e85d752 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: allow apps to override EXPORT_RUNTIME_METHODSLorn Potter2022-08-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Developers can add to Emscripten's EXPORT_RUNTIME_METHODS by defining their own using: QT_WASM_EXTRA_EXPORTED_METHODS Which will add on to Qt's default exported runtime methods of UTF16ToString,stringToUTF16 for cmake: set_target_properties(<target> PROPERTIES QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap") or set(QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap") for qmake: QT_WASM_EXTRA_EXPORTED_METHODS = ccall,cwrap Done-with: Mikolaj Boc Fixes: QTBUG-104882 Pick-to: 6.4 Change-Id: I9678bdb7b077aaa8527057212ea4e161c0be0b60 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: update emscripten to 3.1.10Lorn Potter2022-05-271-1/+1
| | | | | | | | Qt 6.4 will require Emscripten 3.1.10 Change-Id: I34d6288489b6674f6fd75134dd1855ae931c79c2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: remove compiler and linker warningsLorn Potter2022-03-171-18/+24
| | | | | | | | | | | INITIAL_MEMORY and PTHREAD_POOL_SIZE are linker flags only USE_PTHREADS is both linker and compiler arguments. Also increase default INITIAL_MEMORY Pick-to: 6.3 Change-Id: Id1998efbf1d6de901f404db7e988f6cafd547a39 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: don’t pass thread linker opts to compilerMorten Johan Sørvig2022-01-171-2/+3
| | | | | | | | | | | | Emscripten now warns against passing e.g. “ALLOW_MEMORY_GROWTH” as a compile option. Add EMCC_THREAD_CFLAGS, which gets compiler flags only. Pick-to: 6.3 Change-Id: Ifcf40c45ca75cfdfc98a12e6b9d47f34158b3407 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: modernize pthreads optionMorten Johan Sørvig2022-01-171-1/+1
| | | | | | | | | | | Use “-pthreads” instead of “-s USE_PTHREADS=1”. This is both a compile and linker option. Pick-to: 6.3 Change-Id: Iaf7cb4ec41577fe596c3e81fda05c03fe0074c08 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: remove deprecated argument for source mapsLorn Potter2021-12-131-6/+1
| | | | | | | | | -g4 was deprecated in Emscripten 2.0.17, and since we are well past that version we can safely use -gsource-map instead. Change-Id: I497155619d6320661f6be0e220b52fa7d6ca0b8e Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: update recommended emscripten to 3.0.0Lorn Potter2021-12-091-1/+1
| | | | | | | [ChangeLog][wasm] Recommended emscripten version is now 3.0.0 Change-Id: I9ae082509415d8f00b8e9970b730ad4a472da310 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: add sse2 compiler flags againMorten Johan Sørvig2021-11-021-0/+8
| | | | | | | Now with QT_FOR_CONFIG += core-private. Change-Id: Iadc61e21db6566f20c32595ef1ab83f37bc5c651 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: remove sse2 config blockMorten Johan Sørvig2021-10-271-7/+0
| | | | | | | | | | | | | | This breaks the build for qmake-based applications, with the error Project ERROR: Could not find feature sse2. Remove the offending section to make applications build again. Pick-to: 6.2 Change-Id: I0b22faa1d8d62e208d79879b822e21637bb03a3e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: add simd supportLorn Potter2021-10-051-0/+8
| | | | | | | | | | | | | | | | | | Emscripten only supports SSE1, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and 128-bit AVX instruction sets at this time. https://emscripten.org/docs/porting/simd.html Browsers might need to enable simd support in the advanced configurations about: config or chrome:flags Enable by configuring Qt with -sse2 Pick-to: 6.2 Fixes: QTBUG-63924 Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* WASM: Don’t set “-g4” by default for qmake buildsMorten Sørvig2021-04-271-6/+18
| | | | | | | | | This increases link time significantly; instead set "-g4" or the new "-gsource-map" only if source maps are enabled. Change-Id: Ibe2d438d48e9ae2fce5f79d4e8a9f17c01cf2485 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: add cmake build supportLorn Potter2021-04-011-12/+12
| | | | | | | | | | | | | | | | A few configure defines get changed: QMAKE_WASM_PTHREAD_POOL_SIZE is now QT_WASM_PTHREAD_POOL_SIZE QMAKE_WASM_TOTAL_MEMORY is now QT_WASM_INITIAL_MEMORY QMAKE_WASM_SOURCE_MAP_BASE is now QT_WASM_SOURCE_MAP_BASE device-option EMSCRIPTEN_ASYNCIFY=1 is QT_EMSCRIPTEN_ASYNCIFY=1 To create source maps for debugging. use device-option QT_WASM_SOURCE_MAP=1 Task-number: QTBUG-78647 Change-Id: If9f30cd7fb408c386d6d69b5f7b1beecf1ab44b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: Boost emscripten 1.39.8 as recommendedLorn Potter2020-03-231-1/+1
| | | | | | | [ChangeLog][WebAssembly] Updated emscripten to version 1.39.8 Change-Id: I8d19f851eb0c0dd912792cee0db69e61cf4fd5f6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-02-181-1/+3
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qlinkedlist.h src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmscreen.cpp Change-Id: Iefca7f9f4966bdc20e7052aca736874861055738
| * wasm: remove dependency on perl to find emscripten versionLorn Potter2020-02-171-1/+3
| | | | | | | | | | | | Change-Id: I0d5224d497b2b5652d1be036f2a90c6c53f0c9df Fixes: QTBUG-81722 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | wasm: fix loading of default_pre.prfLorn Potter2020-02-151-1/+1
|/ | | | | | | | This fixes windows build and detection of c++ version Task-number: QTBUG-80610 Change-Id: I5196e83f9aad6663aea47c31ae4a2da4c4d74e94 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* wasm: do not use clamp mode for upstream LLVMLorn Potter2019-12-162-24/+24
| | | | | | | | | | Emscripten version 1.39.0 and above are based upon upstream LLVM, which does not contain BINARYEN_TRAP_MODE Fixes: QTBUG-80691 Change-Id: I6129f84a31a607c202e13847b50705ef1c809630 Reviewed-by: jian liang <jianliang79@gmail.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: enforce emscripten versionLorn Potter2019-12-112-0/+30
| | | | | | | | | | | | This creates a define in the binary, as well as writing emscripten version for qmake. It also enforces app builder to use a certain known version. Task-number: QTBUG-77745 Change-Id: I37691512171635cec66aa3ffa16258081f3f1e1b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* WebAssembly: Do not use sed directly for wasm_shell.html deploymentJoerg Bornemann2019-12-091-1/+1
| | | | | | | | | Use $$QMAKE_STREAM_EDITOR, instead, which will on Windows expand to "qmake -install sed" (triggering qmake's own sed implementation) and otherwise expand to "sed". Change-Id: I57da5fb3a4f6e5a09ae25c947caa0a10d279b480 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* wasm: allow setting total memory for non thread buildsLorn Potter2019-08-221-10/+14
| | | | | | | | 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>
* WASM: Make wasm_shell.html compatible with CMake configure_fileFredrik Orderud2019-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The CMake configure_file command is commonly used copy & modify template files during the build process. One limitation, thought, is that configure_file expect the variables to be replaced to be encoded using either a @APPNAME@ or ${APPNAME} convention. This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to make the HTML template file compatible with CMake configure_file. With this commit, it becomes possible to write the following CMake function that mimics what QMake is already doing: function(copy_html_js_launch_files target) set(APPNAME ${target}) configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html" "${target}.html") configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js" qtloader.js COPYONLY) endfunction() Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362 Reference: https://cmake.org/cmake/help/latest/command/configure_file.html Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Wasm: enable thread supportMorten Johan Sørvig2019-02-071-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | configure.json: Make the “thread” feature be allowed for wasm but disabled by default. Change qmake.conf and wasm.prf to enable Emscripten pthreads mode: - Add USE_PTHREADS=1 linker flag - Add PTHREAD_POOL_SIZE linker flag with a default pool size (4). - Add TOTAL_MEMORY linker flag to set available memory (1GB) It is possible to override options such as PTHREAD_POOL_SIZE from the application .pro file using QMAKE_WASM_PTHREAD_POOL_SIZE To change TOTAL_MEMORY, use QMAKE_WASM_TOTAL_MEMORY Make qtloader.js work in pthreads mode: - The Module.instantiateWasm callback must provide the module in addition to the instance to Emscripten. - Set Module.mainScriptUrlOrBlob so that the pthreads web workers can access the main script Task-number: QTBUG-64625 Change-Id: I1ab5a559ec97c27c5fc24500ba5f863bcd275141 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Wasm: enable source map support for debug buildsMorten Johan Sørvig2019-02-071-0/+7
| | | | | | | | | | The source map location can be configured by setting QMAKE_WASM_SOURCE_MAP_BASE in the .pro file. Fall back to “http://localhost:8000” if not set. Task-number: QTBUG-72002 Change-Id: I9da80dacdefc272f267e5db4caac274d93ba4479 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* WebAssembly: Fix compilation of application on Windows hostEskil Abrahamsen Blomfeldt2018-12-031-2/+2
| | | | | | | | | | | When running configure on a Windows host, it would fail with the error that the copy statement was invalid, due to the forward slashes. This makes configure finish without errors. Task-number: QTBUG-72000 Change-Id: Id315d7436bbbfd2cd5c5f2dfcfe0c3dc3b9e34c2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix qpa plugin build system integrationOswald Buddenhagen2018-11-211-12/+0
| | | | | | | | | | | fix the plugin name (it was missing the leading 'q') and the name used in configure (the latter making it unnecessary to mess with it in the mkspec). the qt.prf override which forced linkage of the plugin is also removed due to being completely redundant. Change-Id: I94687a34a295c36754e36a298af902b656ba2ecc Reviewed-by: Kyle Edwards <kyle.edwards@kitware.com> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* WebAssembly for QtBaseMorten Johan Sørvig2018-08-302-0/+93
This is the squashed diff from wip/webassembly to dev. Done-with: Peng Wu <peng.wu@intopalo.com> Done-with: Sami Enne <sami.enne@intopalo.com> Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Started-by: Andrew Knight <andrew.knight@intopalo.com> Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>