extern crate bindgen; extern crate cc; use std::env; use std::path::PathBuf; fn main() { ::cc::Build::new().define("_XOPEN_SOURCE", None) .include("c_include") .flag("-Werror=incompatible-pointer-types") .flag("-Wno-unused-parameter") .files([ "src/shl-htable.c", "src/screen.c", "src/render.c", "src/unicode.c", ].iter()) .compile("screen"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); ::bindgen::Builder::default() .use_core().ctypes_prefix("::libc") .header("c_include/libtsm.h") .hide_type("tsm_age_t") .hide_type("tsm_screen_attr") .raw_line("pub type tsm_age_t = ::core::num::Wrapping;") .raw_line(r#"#[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct tsm_screen_attr { pub fg_code: u8, pub bg_code: u8, pub fg_rgb: [u8; 3], pub bg_rgb: [u8; 3], pub flags: ::AttrFlags }"#) .generate().ok() .and_then(|bs| bs.write_to_file(out_path.join("raw.rs")).ok()) .unwrap(); }