From df865158be735b6eb3deb99edd587eb9ba2646a0 Mon Sep 17 00:00:00 2001 From: Andrew Hayzen Date: Mon, 18 Nov 2024 11:43:29 +0000 Subject: [PATCH] cmake: set RUST_CXX_NO_EXCEPTIONS when building for emscripten --- cmake/CxxQt.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/CxxQt.cmake b/cmake/CxxQt.cmake index d4ddb66..678efa8 100644 --- a/cmake/CxxQt.cmake +++ b/cmake/CxxQt.cmake @@ -61,6 +61,13 @@ function(cxx_qt_import_crate) "QMAKE=${IMPORT_CRATE_QMAKE}" $<$:RUSTC_WRAPPER=${CMAKE_RUSTC_WRAPPER}>) + # When using WASM ensure that we have RUST_CXX_NO_EXCEPTIONS set + if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") + set(EMSCRIPTEN_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRUST_CXX_NO_EXCEPTIONS") + message(STATUS "CXX-Qt found emscripten setting CXXFLAGS=${EMPSCRIPTEN_CXX_FLAGS}") + corrosion_set_env_vars(${CRATE} "CXXFLAGS=${EMPSCRIPTEN_CXX_FLAGS}") + endif() + file(MAKE_DIRECTORY "${IMPORT_CRATE_CXX_QT_EXPORT_DIR}/crates/${CRATE}/include/") target_include_directories(${CRATE} INTERFACE "${IMPORT_CRATE_CXX_QT_EXPORT_DIR}/crates/${CRATE}/include/")