diff --git a/build.rs b/build.rs index 56f7d51..7c7df8e 100644 --- a/build.rs +++ b/build.rs @@ -25,6 +25,9 @@ use std::env; fn main() { let target = env::var("TARGET").unwrap(); + println!("cargo::rustc-check-cfg=cfg(hidapi)"); + println!("cargo::rustc-check-cfg=cfg(libusb)"); + if target.contains("linux") { compile_linux(); } else if target.contains("windows") { diff --git a/src/lib.rs b/src/lib.rs index d81686a..21ce7b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,6 +59,7 @@ //! Since `hidapi` 0.12 it is possible to open MacOS devices with shared access, so that multiple //! [`HidDevice`] handles can access the same physical device. For backward compatibility this is //! an opt-in that can be enabled with the `macos-shared-device` feature flag. +#![cfg_attr(docsrs, feature(doc_cfg))] mod error; mod ffi;