wasm: Flesh out side module and main module logic for shared builds
Task-number: QTBUG-63925 Change-Id: I9da8ca0364a4fe6c9ec4d272657e1cf726d305c4 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
parent
9c56a77027
commit
b0af876bed
@ -93,17 +93,19 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
|
||||
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
||||
|
||||
# plugins are SIDE_MODULE
|
||||
target_compile_options("${wasmTarget}" INTERFACE
|
||||
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:" -s SIDE_MODULE=1>)
|
||||
target_link_options("${wasmTarget}" INTERFACE
|
||||
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:" -s SIDE_MODULE=1>)
|
||||
set(side_modules
|
||||
MODULE_LIBRARY SHARED_LIBRARY)
|
||||
set(enable_side_module_if_needed
|
||||
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,${side_modules}>:SHELL:-s SIDE_MODULE=1>")
|
||||
set(enable_main_module_if_needed
|
||||
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:SHELL:-s MAIN_MODULE=1>")
|
||||
set(set_shared_module_type_if_needed
|
||||
"${enable_side_module_if_needed}"
|
||||
"${enable_main_module_if_needed}"
|
||||
)
|
||||
|
||||
# shared libs are SIDE_MODULE
|
||||
target_compile_options("${wasmTarget}" INTERFACE
|
||||
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:" -s SIDE_MODULE=1>)
|
||||
target_link_options("${wasmTarget}" INTERFACE
|
||||
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:" -s SIDE_MODULE=1>)
|
||||
target_compile_options("${wasmTarget}" INTERFACE "${set_shared_module_type_if_needed}")
|
||||
target_link_options("${wasmTarget}" INTERFACE "${set_shared_module_type_if_needed}")
|
||||
|
||||
else()
|
||||
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1")
|
||||
|
@ -47,6 +47,17 @@ exists($$QMAKE_QT_CONFIG) {
|
||||
QMAKE_LFLAGS_DEBUG += -msimd128 -msse -msse2
|
||||
}
|
||||
|
||||
qtConfig(shared) {
|
||||
contains(TEMPLATE, .*app) {
|
||||
EMCC_MODULE_FLAGS = -s MAIN_MODULE=1
|
||||
}
|
||||
contains(TEMPLATE, .*lib):!static: {
|
||||
EMCC_MODULE_FLAGS = -s SIDE_MODULE=1
|
||||
}
|
||||
EMCC_CFLAGS += $$EMCC_MODULE_FLAGS
|
||||
EMCC_LFLAGS += $$EMCC_MODULE_FLAGS
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS += $$EMCC_LFLAGS
|
||||
QMAKE_LFLAGS_DEBUG += $$EMCC_LFLAGS
|
||||
QMAKE_CFLAGS += $$EMCC_CFLAGS
|
||||
|
Loading…
x
Reference in New Issue
Block a user