initial rust oidc lib

This commit is contained in:
Grant Limberg 2021-10-27 16:11:06 -07:00
commit 271dfc0d2b
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
5 changed files with 1398 additions and 0 deletions

37
zeroidc/build.rs Normal file
View 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")
}
}