MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / prepare

Method prepare

crates/test/src/cpp.rs:58–76  ·  view source on GitHub ↗
(&self, runner: &mut Runner)

Source from the content-addressed store, hash-verified

56 }
57
58 fn prepare(&self, runner: &mut Runner) -> anyhow::Result<()> {
59 let compiler = clangpp(runner);
60 let cwd = std::env::current_dir()?;
61 let dir = cwd.join(&runner.opts.artifacts).join("cpp");
62
63 super::write_if_different(&dir.join("test.cpp"), "int main() { return 0; }")?;
64
65 println!("Testing if `{}` works...", compiler.display());
66 runner
67 .run_command(Command::new(&compiler).current_dir(&dir).arg("test.cpp"))
68 .inspect_err(|_| {
69 eprintln!(
70 "Error: failed to find `{}`. Hint: pass `--wasi-sdk-path` or set `WASI_SDK_PATH`",
71 compiler.display()
72 );
73 })?;
74
75 Ok(())
76 }
77
78 fn generate_bindings_prepare(
79 &self,

Callers

nothing calls this directly

Calls 5

clangppFunction · 0.85
write_if_differentFunction · 0.85
newFunction · 0.85
joinMethod · 0.80
run_commandMethod · 0.80

Tested by

no test coverage detected