ngt-sys 1.12.2

Native bindings to the NGT library.
Documentation
use std::env;
use std::path::PathBuf;

fn main() {
    let mut config = cmake::Config::new("NGT");

    if env::var("CARGO_FEATURE_SHARED_MEM").is_ok() {
        config.define("NGT_SHARED_MEMORY_ALLOCATOR", "ON");
    }

    if env::var("CARGO_FEATURE_LARGE_DATA").is_ok() {
        config.define("NGT_LARGE_DATASET", "ON");
    }

    let dst = config.build();

    println!("cargo:rustc-link-search=native={}/lib", dst.display());
    println!("cargo:rustc-link-lib=dylib=ngt");

    let bindings = bindgen::Builder::default()
        .header(format!("{}/include/NGT/Capi.h", dst.display()))
        .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("Couldn't write bindings");
}