wasm: add support for enabling wasm excptions

Add support for enabling -fwasm-exceptions at compile and
link time, which enables use of C++ exceptions.

Wasm-exceptions is an in-progress roadmap item (see
https://webassembly.org/roadmap/), but is supported
by the major browsers

Change-Id: I6e2847206a46ed8038320c99725bc09a0344d1b4
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Morten Sørvig 2022-10-18 14:02:02 +02:00 committed by Morten Johan Sørvig
parent b813a5b120
commit 2ab347b0dd
2 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,12 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_compile_options("${wasmTarget}" INTERFACE -O2 -msimd128 -msse -msse2)
endif()
# wasm exceptions
if (QT_FEATURE_wasm_exception)
target_compile_options("${wasmTarget}" INTERFACE -fwasm-exceptions)
target_link_options("${wasmTarget}" INTERFACE -fwasm-exceptions)
endif()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s DISABLE_EXCEPTION_CATCHING=1")
if (QT_FEATURE_thread)

View File

@ -940,6 +940,12 @@ qt_feature("posix_fallocate" PRIVATE
LABEL "POSIX fallocate()"
CONDITION TEST_posix_fallocate
)
qt_feature("wasm_exceptions" PRIVATE
LABEL "WebAssembly exception handling"
AUTODETECT OFF
)
qt_feature_definition("wasm_exceptions" "QT_WASM_EXCEPTIONS" VALUE "1")
qt_feature_config("wasm_exceptions" QMAKE_PRIVATE_CONFIG)
qt_feature("alloca_h" PRIVATE
LABEL "alloca.h"
CONDITION TEST_alloca_h