wasm32-wasi SDK doesn't support exceptions. This commit disables exceptions when compile for wasm32-wasi.
+use std::env;
use std::path::Path;
extern crate cc;
@@ -18,6 +19,11 @@ fn main() {
let mut cpp_config = cc::Build::new();
cpp_config.cpp(true);
cpp_config.include(&src_dir);
+
+ if env::var("TARGET").unwrap() == "wasm32-wasi" {
+ cpp_config.flag_if_supported("-fno-exceptions");
+ }
+
cpp_config
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable");
