mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 10:37:33 -07:00
add smee client
This commit is contained in:
parent
a6b764bf7c
commit
4674bb5c8b
13 changed files with 1901 additions and 1737 deletions
36
rustybits/smeeclient/build.rs
Normal file
36
rustybits/smeeclient/build.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
extern crate cbindgen;
|
||||
|
||||
use cbindgen::{Config, Language};
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
|
||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||
let output_file = target_dir().join(format!("{}.h", package_name)).display().to_string();
|
||||
|
||||
let config = Config {
|
||||
language: Language::C,
|
||||
cpp_compat: true,
|
||||
namespace: Some(String::from("smeeclient")),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
cbindgen::generate_with_config(&crate_dir, config)
|
||||
.unwrap()
|
||||
.write_to_file(&output_file);
|
||||
}
|
||||
|
||||
/// Find the location of the `target/` directory. Note that this may be
|
||||
/// overridden by `cmake`, so we also need to check the `CARGO_TARGET_DIR`
|
||||
/// variable.
|
||||
fn target_dir() -> PathBuf {
|
||||
if let Ok(target) = env::var("CARGO_TARGET_DIR") {
|
||||
PathBuf::from(target)
|
||||
} else {
|
||||
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
|
||||
.join("..")
|
||||
.join("target")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue