-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (28 loc) · 948 Bytes
/
build.rs
File metadata and controls
32 lines (28 loc) · 948 Bytes
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
extern crate cc;
use glob::glob;
fn main() {
let out_dir = std::env::var("OUT_DIR").unwrap();
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-link-search={}", out_dir);
cc::Build::new()
.files(
glob("./vendor/mruby/mrbc-src/*.c")
.expect("cannot find c source")
.map(|x| x.unwrap())
)
.warnings(false)
.define("MRB_NO_PRESYM", "")
.include("./vendor/mruby/include")
.flag("-fPIC")
.flag("-c")
.compile("mruby_mrbc");
println!("cargo:rustc-link-lib=mruby_mrbc");
let bindings = bindgen::Builder::default()
.header("vendor/mruby/include/wrapper.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
bindings
.write_to_file("./src/bindings.rs")
.expect("Couldn't write bindings!");
}