tokio example requires enabling a cargo feature
and also a dummy C example
This commit is contained in:
@@ -13,7 +13,11 @@ fn main() -> anyhow::Result<()> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
examples.insert((path.file_stem().unwrap().to_str().unwrap().to_owned(), dir));
|
examples.insert((
|
||||||
|
path.clone(),
|
||||||
|
path.file_stem().unwrap().to_str().unwrap().to_owned(),
|
||||||
|
dir,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("======== Building libwasmtime.a ===========");
|
println!("======== Building libwasmtime.a ===========");
|
||||||
@@ -21,7 +25,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
.args(&["build"])
|
.args(&["build"])
|
||||||
.current_dir("crates/c-api"))?;
|
.current_dir("crates/c-api"))?;
|
||||||
|
|
||||||
for (example, is_dir) in examples {
|
for (example_path, example, is_dir) in examples {
|
||||||
if example == "README" {
|
if example == "README" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -45,10 +49,17 @@ fn main() -> anyhow::Result<()> {
|
|||||||
.arg(target))?;
|
.arg(target))?;
|
||||||
}
|
}
|
||||||
println!("======== Rust example `{}` ============", example);
|
println!("======== Rust example `{}` ============", example);
|
||||||
run(Command::new("cargo")
|
let mut cargo_cmd = Command::new("cargo");
|
||||||
.arg("run")
|
cargo_cmd.arg("run").arg("--example").arg(&example);
|
||||||
.arg("--example")
|
if is_dir {
|
||||||
.arg(&example))?;
|
let mut features_path = std::path::PathBuf::from(example_path);
|
||||||
|
features_path.push("CARGO_FEATURES");
|
||||||
|
if features_path.exists() {
|
||||||
|
let features = std::fs::read_to_string(features_path)?;
|
||||||
|
cargo_cmd.arg("--features").arg(features);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(&mut cargo_cmd)?;
|
||||||
|
|
||||||
println!("======== C/C++ example `{}` ============", example);
|
println!("======== C/C++ example `{}` ============", example);
|
||||||
for extension in ["c", "cc"].iter() {
|
for extension in ["c", "cc"].iter() {
|
||||||
|
|||||||
1
examples/tokio/CARGO_FEATURES
Normal file
1
examples/tokio/CARGO_FEATURES
Normal file
@@ -0,0 +1 @@
|
|||||||
|
wasmtime-wasi/tokio
|
||||||
5
examples/tokio/main.c
Normal file
5
examples/tokio/main.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
// This example is specific to integrating with Rust's tokio ecosystem, so
|
||||||
|
// it isnt applicable to C/C++.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user