detect docs.rs build properly
MODIFY
Cargo.toml
Cargo.toml
@@ -33,3 +33,6 @@ matches = "0.1"
[features]
buildtime_bindgen = []
+
+[package.metadata.docs.rs]
+features = [ "docs-only" ]

MODIFY
build.rs
build.rs
@@ -349,8 +349,7 @@ fn build_wrapper(opencv: pkg_config::Library) -> Result<(), Box<dyn Error>> {
}
fn main() -> Result<(), Box<dyn Error>> {
- // detect building for docs.rs
- if !std::env::var("OUT_DIR")?.starts_with("/home/cratesfyi/cratesfyi/debug/build/") {
+ if !cfg!(feature = "docs-only") {
build_wrapper(link_wrapper()?)?;
let mut config = cpp_build::Config::new();
config.flag_if_supported("-Wno-class-memaccess");

detect docs.rs build properly