aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-09-22 19:09:40 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-09-22 19:09:40 +0200
commitc484777f3a7dde9e9fe8f47344fd8a6b30840b78 (patch)
tree3d6c111f619e8b2b428e9a1744a9dc15b4f1ca3d /src/lib.rs
parent4932d2376cc03c64eb82972824be673cdc2e0741 (diff)
downloadnitrokey-sys-rs-c484777f3a7dde9e9fe8f47344fd8a6b30840b78.tar.gz
nitrokey-sys-rs-c484777f3a7dde9e9fe8f47344fd8a6b30840b78.tar.bz2
Add feature to generate bindings during build
This patch adds the bindgen feature to the crate that allows users to re-generate the bindings, including layout tests, during the build instead of using the pre-generated bindings. Per default, this feature is disabled.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a179da8..81a98bc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,10 +2,15 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
+#[cfg(not(feature = "bindgen"))]
mod ffi;
+#[cfg(not(feature = "bindgen"))]
pub use crate::ffi::*;
+#[cfg(feature = "bindgen")]
+include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
+
#[cfg(test)]
mod tests {
use super::*;