Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,26 +293,18 @@ where
}

#[cfg(feature = "bindgen")]
fn bindgen<'a, D, H, X, K, V>(out_dir: D, header_file: H, defines: X, mut add_cflags: Vec<String>)
fn bindgen<'a, D, H, X, K, V>(out_dir: D, header_file: H, defines: X, add_cflags: Vec<String>)
where
D: AsRef<Path>,
H: AsRef<Path>,
X: IntoIterator<Item = &'a (K, Option<V>)>,
K: AsRef<str> + 'a,
V: AsRef<str> + 'a,
{
let mut target = env::var("TARGET").unwrap();
let out_dir = out_dir.as_ref();
let header_file = header_file.as_ref();

// *-pc-windows-gnullvm is special for Rust, Clang accepts only
// *-pc-windows-gnu
if target.ends_with("windows-gnullvm") {
target = target.replace("llvm", "");
}

let mut cflags = vec![format!("--target={}", target)];
cflags.append(&mut add_cflags);
let mut cflags = add_cflags;

//format!("-I{}", out_dir.parent().display()),

Expand Down Expand Up @@ -358,7 +350,7 @@ where
let dest_dir = Path::new("src").join("bindings");
fs::create_dir_all(&dest_dir).unwrap();

let dest_file = format!("{}.rs", target);
let dest_file = format!("{}.rs", env::var("TARGET").unwrap());
fs::copy(&bindings_file, dest_dir.join(dest_file)).unwrap();
}
}
Loading