From 6b1a292daab0457789aa8d1a69e096e468fa150b Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Fri, 9 Oct 2020 19:11:08 +0200 Subject: [PATCH] Make cargo-run of example work on windows --- spirv-builder/src/lib.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/spirv-builder/src/lib.rs b/spirv-builder/src/lib.rs index 7b85b04e9e..703fad4d66 100644 --- a/spirv-builder/src/lib.rs +++ b/spirv-builder/src/lib.rs @@ -42,6 +42,7 @@ struct RustcOutput { reason: String, filenames: Option>, } + fn get_last_artifact(out: &str) -> String { let out = serde_json::Deserializer::from_str(out).into_iter::(); let last = out @@ -49,10 +50,19 @@ fn get_last_artifact(out: &str) -> String { .filter(|line| line.reason == "compiler-artifact") .last() .expect("Did not find output file in rustc output"); + let mut filenames = last.filenames.unwrap(); - println!("{:?}", filenames); - assert_eq!(filenames.len(), 1); - filenames.pop().unwrap() + eprintln!("{:?}", filenames); + if cfg!(windows) { + filenames + .iter() + .find(|&v| v.ends_with(".dll") || v.ends_with(".spv")) + .unwrap() + .clone() + } else { + assert_eq!(filenames.len(), 1); + filenames.pop().unwrap() + } } fn build_rustc_codegen_spirv(path_to_codegen: &Path) -> Result { @@ -62,7 +72,7 @@ fn build_rustc_codegen_spirv(path_to_codegen: &Path) -> Result