Skip to content

Commit f700efe

Browse files
authored
Remove C++ dependency from wasmtime (#1365)
* Remove C++ dependency from `wasmtime` This commit removes the last wads of C++ that we have in wasmtime, meaning that building wasmtime no longer requires a C++ compiler. It still does require a C toolchain for some minor purposes, but hopefully we can remove that over time too! The motivation for doing this is to consolidate all our signal-handling code into one location in one language so you don't have to keep crossing back and forth when understanding what's going on. This also allows us to remove some extra cruft that wasn't necessary from the C++ original implementation. Additionally this should also make building wasmtime a bit more portable since it's often easier to acquire a C toolchain than it is to acquire a C++ toolchain. (e.g. if you're cross-compiling to a musl target) * Typos
1 parent c50c24e commit f700efe

9 files changed

Lines changed: 260 additions & 879 deletions

File tree

crates/runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cfg-if = "0.1.9"
2222
backtrace = "0.3.42"
2323

2424
[target.'cfg(target_os = "windows")'.dependencies]
25-
winapi = { version = "0.3.7", features = ["winbase", "memoryapi"] }
25+
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi"] }
2626

2727
[build-dependencies]
2828
cc = "1.0"

crates/runtime/build.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
fn main() {
2-
println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.cpp");
3-
println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.hpp");
4-
println!("cargo:rerun-if-changed=signalhandlers/Trampolines.cpp");
5-
let target = std::env::var("TARGET").unwrap();
6-
let mut build = cc::Build::new();
7-
build
8-
.cpp(true)
9-
.warnings(false)
10-
.file("signalhandlers/SignalHandlers.cpp")
11-
.file("signalhandlers/Trampolines.cpp");
12-
if !target.contains("windows") {
13-
build
14-
.flag("-std=c++11")
15-
.flag("-fno-exceptions")
16-
.flag("-fno-rtti");
17-
}
18-
19-
build.compile("signalhandlers");
2+
println!("cargo:rerun-if-changed=src/helpers.c");
3+
cc::Build::new()
4+
.warnings(true)
5+
.file("src/helpers.c")
6+
.compile("helpers");
207
}

0 commit comments

Comments
 (0)