Commit Graph

7 Commits

Author SHA1 Message Date
Morten Sørvig
53eb44906c wasm: don’t set exit_runtime
Go with Emscripten’s default of not shutting down on
main() exit; this allows for writing main() in such
a way that avoids the exec() workaround.

Existing main() implementations (which do use the exec()
workaround) do not shut down Qt cleanly anyway, so we
gain little by shutting down the Emscripten runtime.

Applications can set this flag if they do want to shut
down on main() exit:
    LFAGS += -s EXIT_RUNTIME=1

Change-Id: I52e1cc2bc907d1d2146822713e39b7610db3f95b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 06:57:21 +00:00
Morten Sørvig
7ee4468a18 wasm: enable MODULARIZE option and set EXPORT_NAME
Make Emscripten generate a global constructor function
("createQtAppInstance()") instead of a global javascript
module object.

This enables more fine-grained control over module
instantiation; previously the module object would be
created when the runtime javascript was evaluated, and
the number of emscripten module/instances was limited
to one per page.

Set EXPORT_NAME to “createQtAppInstance” which avoids
collisions with other non-Qt Emscripten modules on
the same page. A further improvement would be to include
the app name in EXPORT_NAME, but this is not done at
this time.

Update the code in qtloader.js to call the constructor
function instead of working on a global module object.
The qtloader.js API is functional before the wasm and
Emscripten modules have been instantiated; store properties
and forward to the Emscripten module when it's created.

Change-Id: I12c49a5b9a4a932bbc46fcc5e5ecc453fd0fe7f0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-22 11:11:20 +00:00
Lorn Potter
ae717aa51f wasm: fix build for emscripten 2.0.14
new syntax rules for EXTRA_EXPORTED_RUNTIME_METHODS valid after 2.0.16

Pick-to: 6.2
Change-Id: Iff33e4c6f3176619fb35ec0994a7cc87b5d937c7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-06-21 23:43:02 +00:00
Lorn Potter
1b4fe5d388 wasm: fix threaded builds
set the thread pool size default to 4

Change-Id: I038a81610c82ac4d162c044d0e1f58196cffc7b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-06-08 08:10:43 +10:00
Lorn Potter
a1c8530a91 wasm: fix cmake syntax for emscripten
fix debugging demangler
Emscripten apparently does not like the quotes in the compiler argument

and remove array syntax

Change-Id: I66652f6bdc5872faf540a877ca01bf75dde47bbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-27 21:16:49 +10:00
Lorn Potter
7c4363ba4c wasm: make sure bind is compiler argument
Fixes: QTBUG-93713
Change-Id: I027caccb5c37bab529c80efac0b575a363be5f89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-14 13:45:28 +10:00
Lorn Potter
4972fdb350 wasm: add cmake build support
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>
2021-04-01 19:23:42 +10:00