wasmi/benches/build.rs

32 lines
1.0 KiB
Rust
Raw Permalink Normal View History

use std::env;
use std::process;
fn main() {
2018-12-11 11:54:06 +00:00
println!("cargo:rerun-if-changed=./wasm-kernel/");
2018-12-11 11:54:06 +00:00
// The CARGO environment variable provides a path to the executable that
// runs this build process.
let cargo_bin = env::var("CARGO").expect("CARGO env variable should be defined");
2018-12-11 11:54:06 +00:00
// Build a release version of wasm-kernel. The code in the output wasm binary
// will be used in benchmarks.
let output = process::Command::new(cargo_bin)
.arg("build")
.arg("--target=wasm32-unknown-unknown")
.arg("--release")
.arg("--manifest-path=./wasm-kernel/Cargo.toml")
.arg("--verbose")
.output()
.expect("failed to execute `cargo`");
2018-12-11 11:54:06 +00:00
if !output.status.success() {
let msg = format!(
"status: {status}\nstdout: {stdout}\nstderr: {stderr}\n",
status = output.status,
stdout = String::from_utf8_lossy(&output.stdout),
stderr = String::from_utf8_lossy(&output.stderr),
);
panic!("{}", msg);
}
}