This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-libzt/pkg/crate/libzt/build.rs

20 lines
515 B
Rust
Raw Normal View History

2021-05-24 21:29:57 -07:00
extern crate bindgen;
2021-05-30 19:51:26 -07:00
use std::env;
use std::path::PathBuf;
2021-05-24 21:29:57 -07:00
fn main() {
2021-05-31 13:51:31 -07:00
println!("cargo:rustc-link-lib=zt");
2021-05-24 21:29:57 -07:00
let bindings = bindgen::Builder::default()
2021-05-31 13:51:31 -07:00
.header("src/include/ZeroTierSockets.h")
2021-05-24 21:29:57 -07:00
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
2021-05-30 19:51:26 -07:00
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
2021-05-24 21:29:57 -07:00
bindings
2021-05-30 19:51:26 -07:00
.write_to_file(out_path.join("libzt.rs"))
2021-05-24 21:29:57 -07:00
.expect("Couldn't write bindings!");
}