aboutsummaryrefslogtreecommitdiff
path: root/build.rs
blob: 470cb969e5a35b780455f9308c415f51867ed1bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
    println!("cargo:rustc-link-lib=nitrokey");

    let bindings = bindgen::Builder::default()
        .header("libnitrokey-3.3/NK_C_API.h")
        .generate()
        .expect("Unable to generate bindings");
    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings
        .write_to_file(out_path.join("bindings.rs"))
        .expect("Could not write bindings");
}