diff --git a/Cargo.toml b/Cargo.toml index 6e3ae4c..2c1abd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,12 @@ build = "src/build.rs" description = "Rust bindings to the System Informer's (formerly known as Process Hacker) `phnt` native Windows headers" # exclude = ["deps"] +[features] +docsrs = [] +default = [] + [package.metadata.docs.rs] +features = ["docsrs"] all-features = true default-target = "x86_64-pc-windows-msvc" targets = [] diff --git a/src/build.rs b/src/build.rs index 5ffa299..e59ab35 100644 --- a/src/build.rs +++ b/src/build.rs @@ -110,8 +110,10 @@ impl BindgenConfig { } fn main() { - println!("Skipping regeneration of bindings for docs."); - return; + if cfg!(feature = "docsrs") { + println!("Skipping regeneration of bindings for docs."); + return; + } std::process::Command::new("git") .args(["submodule", "update", "--remote", "--recursive"]) diff --git a/src/lib.rs b/src/lib.rs index 4b505da..9ed78a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,9 @@ non_camel_case_types, non_upper_case_globals )] +#[cfg(not(feature="docsrs"))] pub mod ffi { + #[cfg(not(feature="docsrs"))] include!(concat!(env!("OUT_DIR"), "\\generated.rs")); use std::arch::asm;