-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.rs
More file actions
24 lines (18 loc) · 707 Bytes
/
Copy pathbuild.rs
File metadata and controls
24 lines (18 loc) · 707 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
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
let path = "./clj"; // where to find the GraalVM-generated stuff
println!("cargo:rustc-link-search=./clj");
println!("cargo:rustc-link-lib=scimacs");
println!("cargo:rustc-link-search={path}", path = path);
let bindings = bindgen::Builder::default()
.header(format!("{path}/LibScimacs.h", path = path))
.clang_arg(format!("-I{path}", path = path))
.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!");
}