Simplify build script
Seeing as we now no longer need to modify generated header files.
This commit is contained in:
parent
8a5bf61d6b
commit
2ff3ad93e5
@ -1,5 +1,4 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -22,23 +21,16 @@ fn main() {
|
|||||||
println!("cargo::rerun-if-changed=lib.rs");
|
println!("cargo::rerun-if-changed=lib.rs");
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
let profile = env::var("PROFILE").unwrap();
|
let profile = env::var("PROFILE").unwrap();
|
||||||
|
cbindgen::Builder::new()
|
||||||
let bindings = cbindgen::Builder::new()
|
|
||||||
.with_crate(&crate_dir)
|
.with_crate(&crate_dir)
|
||||||
.with_language(cbindgen::Language::C)
|
.with_language(cbindgen::Language::C)
|
||||||
.with_style(cbindgen::Style::Tag)
|
.with_style(cbindgen::Style::Tag)
|
||||||
.generate()
|
.generate()
|
||||||
.expect("Unable to generate bindings");
|
.expect("Unable to generate bindings")
|
||||||
|
.write_to_file(
|
||||||
let mut buf = Vec::new();
|
PathBuf::from(&crate_dir)
|
||||||
bindings.write(&mut buf);
|
.join("target")
|
||||||
let header = String::from_utf8(buf).unwrap();
|
.join(&profile)
|
||||||
fs::write(
|
.join("garnet_rs.h"),
|
||||||
PathBuf::from(&crate_dir)
|
);
|
||||||
.join("target")
|
|
||||||
.join(&profile)
|
|
||||||
.join("garnet_rs.h"),
|
|
||||||
header,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user