matio-sys 0.1.2

Low level bindings to libmatio
/*
 * Copyright (c) 2018 Frank Fischer <frank-fischer@shadow-soft.de>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

extern crate bindgen;
extern crate metadeps;

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

fn main() {
    if let Err(err) = metadeps::probe() {
        eprintln!("error: {}", err);
        std::process::exit(1);
    }

    let bindings = bindgen::Builder::default()
        .rustfmt_bindings(true)
        .header("wrapper.h")
        .derive_copy(false)
        .derive_debug(false)
        .derive_hash(false)
        .derive_partialord(false)
        .derive_partialeq(false)
        .prepend_enum_name(false)
        .whitelist_function("Mat_.*")
        .whitelist_type("matio_.*")
        .whitelist_type("mat_acc")
        .link("matio")
        .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("Coundn't write bindings!");
}