File: build.rs

package info (click to toggle)
rust-libseat-sys 0.1.9-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 100 kB
  • sloc: makefile: 4; ansic: 2
file content (34 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#[cfg(all(feature = "use_bindgen", not(any(docsrs, feature = "docs_rs"))))]
fn main() {
    use bindgen::Builder;

    let library = pkg_config::probe_library("libseat").unwrap();

    println!("cargo:rerun-if-changed=src/wrapper.h");

    let mut builder = Builder::default()
        .header("src/wrapper.h")
        .layout_tests(false)
        .allowlist_recursively(false)
        .allowlist_type("libseat.*")
        .allowlist_function("libseat.*")
        .allowlist_var("libseat.*")
        .blocklist_item("libseat_set_log_handler")
        .blocklist_item("libseat_log_func");
    for i in &library.include_paths {
        builder = builder.clang_arg(format!("-I{}", i.display()));
    }
    let bindings = builder.generate().expect("Unable to generate bindings");

    bindings
        .write_to_file("./src/bindings.rs")
        .expect("Couldn't write bindings!");
}

#[cfg(all(not(feature = "use_bindgen"), not(any(docsrs, feature = "docs_rs"))))]
fn main() {
    pkg_config::probe_library("libseat").unwrap();
}

#[cfg(any(docsrs, feature = "docs_rs"))]
fn main() {}