mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 02:40:13 +00:00
initial rust oidc lib
This commit is contained in:
parent
0032df3bf1
commit
271dfc0d2b
1
.gitignore
vendored
1
.gitignore
vendored
@ -122,3 +122,4 @@ attic/world/*.c25519
|
||||
attic/world/mkworld
|
||||
workspace/
|
||||
workspace2/
|
||||
zeroidc/target/
|
||||
|
1330
zeroidc/Cargo.lock
generated
Normal file
1330
zeroidc/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
zeroidc/Cargo.toml
Normal file
17
zeroidc/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "zeroidc"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
openidconnect = "2.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
cbindgen = "0.20.0"
|
37
zeroidc/build.rs
Normal file
37
zeroidc/build.rs
Normal file
@ -0,0 +1,37 @@
|
||||
extern crate cbindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use cbindgen::{Config, Language};
|
||||
|
||||
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!("{}.hpp", package_name))
|
||||
.display()
|
||||
.to_string();
|
||||
|
||||
let config = Config {
|
||||
language: Language::C,
|
||||
cpp_compat: true,
|
||||
namespace: Some(String::from("zeroidc")),
|
||||
..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("target")
|
||||
}
|
||||
}
|
13
zeroidc/src/lib.rs
Normal file
13
zeroidc/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn hello_rust() {
|
||||
println!("Hello, Rust from C!")
|
||||
}
|
Loading…
Reference in New Issue
Block a user