From 6c52d9bcf2ce65b3183a70d9122abc5009f98ec0 Mon Sep 17 00:00:00 2001 From: Sympatron GmbH <35803463+Sympatron@users.noreply.github.com> Date: Fri, 27 Sep 2024 22:16:46 +0200 Subject: [PATCH] Make libosdp-sys no_std compatible --- libosdp-sys/Cargo.toml | 4 +++- libosdp-sys/build.rs | 5 ++--- libosdp-sys/src/lib.rs | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libosdp-sys/Cargo.toml b/libosdp-sys/Cargo.toml index 67dab7b..0181ef1 100644 --- a/libosdp-sys/Cargo.toml +++ b/libosdp-sys/Cargo.toml @@ -14,11 +14,13 @@ categories = ["development-tools", "embedded"] [build-dependencies] anyhow = "1.0.75" -bindgen = "0.69.1" +bindgen = "0.70.0" build-target = "0.4.0" cc = "1.0.83" [features] +default = ["std"] +std = [] packet_trace = [] data_trace = [] skip_mark_byte = [] diff --git a/libosdp-sys/build.rs b/libosdp-sys/build.rs index 5f23ca0..6946d9a 100644 --- a/libosdp-sys/build.rs +++ b/libosdp-sys/build.rs @@ -166,10 +166,9 @@ fn main() -> Result<()> { /* generate bindings */ - let args = vec![ - format!("-I{}", &out_dir), - ]; + let args = vec![format!("-I{}", &out_dir)]; let bindings = bindgen::Builder::default() + .use_core() .header("vendor/include/osdp.h") .clang_args(args) .generate() diff --git a/libosdp-sys/src/lib.rs b/libosdp-sys/src/lib.rs index d64b2be..0d4683b 100644 --- a/libosdp-sys/src/lib.rs +++ b/libosdp-sys/src/lib.rs @@ -1,3 +1,4 @@ +#![cfg_attr(not(feature = "std"), no_std)] //! Auto generated (bindgen) wrapper for LibOSDP C API exposed from osdp.h //! [here](https://github.com/goToMain/libosdp/blob/master/include/osdp.h).