Skip to content
Open
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
10 changes: 9 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ fn link_to_libraries(statik: bool) {
}

fn main() {
let target_triple = env::var("TARGET").unwrap();
let statik = env::var("CARGO_FEATURE_STATIC").is_ok();
let ffmpeg_major_version: u32 = env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap();

Expand Down Expand Up @@ -1072,11 +1073,18 @@ fn main() {
.iter()
.map(|include| format!("-I{}", include.to_string_lossy()));

let clang_args = std::iter::empty()
.chain(clang_includes.into_iter())
.chain([
"-target".to_string(), target_triple.clone(),
])
.collect::<Vec<_>>();

// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
// the resulting bindings.
let mut builder = bindgen::Builder::default()
.clang_args(clang_includes)
.clang_args(clang_args)
.ctypes_prefix("libc")
// https://github.com/rust-lang/rust-bindgen/issues/550
.blocklist_type("max_align_t")
Expand Down