simplify spirv builder
This commit is contained in:
parent
de7da0540d
commit
029a278177
|
@ -24,6 +24,6 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let initial_result = builder.build()?;
|
||||
|
||||
let module_path = initial_result.module.unwrap_single();
|
||||
println!("get_shader: built:\n{}", module_path.display());
|
||||
println!("cargo:rustc-env=SPIRV_MODULE_PATH={}", module_path.display());
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
println!("target_dir: {:?}", target_dir);
|
||||
println!("manifest_path: {:?}", manifest_path);
|
||||
|
||||
let output = std::process::Command::new("cargo")
|
||||
let status = std::process::Command::new("cargo")
|
||||
.args([
|
||||
"run",
|
||||
"--release",
|
||||
|
@ -46,12 +46,16 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.arg(manifest_path)
|
||||
.arg("--target-dir")
|
||||
.arg(target_dir)
|
||||
.stdout(std::process::Stdio::inherit())
|
||||
.stderr(std::process::Stdio::inherit())
|
||||
.output()?;
|
||||
.status()?;
|
||||
|
||||
let stdout = String::from_utf8(output.stdout)?;
|
||||
let mod_path = stdout.trim_end().rsplit("\n").next().expect("spirv module path");
|
||||
println!("stdout: {}", stdout);
|
||||
println!("cargo:rustc-env=SPIRV_MODULE_PATH={}", mod_path);
|
||||
if !status.success() {
|
||||
if let Some(code) = status.code() {
|
||||
std::process::exit(code);
|
||||
} else {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue