wasm: move MODULARIZE to EXPORT_NAME finalizer

This avoids a "must set EXPORT_NAME when using MODULARIZE
with pthreads" error when linking libQtGui.so.

Both settings only apply for the final executable since
they affect how the wasm module is loaded from JS;
setting them together here makes sense.

Change-Id: Ibebeeee38203486675c43b416cb674e8ece9c147
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 9768d8e1ba21adace1f590420791e6924a9fad8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2024-05-29 14:49:55 +02:00 committed by Qt Cherry-pick Bot
parent 7a67ed7705
commit e7cf150caa
2 changed files with 1 additions and 3 deletions

View File

@ -18,9 +18,6 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_compile_options("${wasmTarget}" INTERFACE "SHELL:-s MEMORY64=1" )
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s MEMORY64=1" -mwasm64)
endif()
# Enable MODULARIZE so that we are able to set EXPORT_NAME later and instantiate on demand (with
# MODULARIZE=0, emscripten creates a global app instance object at Javascript eval time)
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s MODULARIZE=1")
#simd
if (QT_FEATURE_wasm_simd128)

View File

@ -126,6 +126,7 @@ endfunction()
function(_qt_internal_set_wasm_export_name target)
_qt_internal_wasm_export_name_for_target(export_name ${target})
target_link_options("${target}" PRIVATE "SHELL:-s MODULARIZE=1")
target_link_options("${target}" PRIVATE "SHELL:-s EXPORT_NAME=${export_name}")
endfunction()