-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
38 lines (29 loc) · 869 Bytes
/
build.rs
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
35
36
37
38
extern crate bindgen;
extern crate cc;
use std::{env, path};
fn main() {
cc::Build::new()
.file("build.c")
.define("STB_IMAGE_IMPLEMENTATION", None)
.warnings(false)
.compile("stb_image");
//println!("cargo:rustc-link-lib=stb_image");
// gen bindings
bindgen::builder()
.header("stb/stb_image.h")
.whitelist_function("stbi_(.*)")
.whitelist_type("stbi_(.*)")
.layout_tests(false)
.rustfmt_bindings(true)
.generate()
.expect("Error generating bindings!!")
// write to disk
.write_to_file({
let mut path = path::PathBuf::from(
env::var_os("OUT_DIR").unwrap().to_str().unwrap()
);
path.push("stb_image.rs");
path
})
.expect("Error writing bindings!!");
}