Skip to content

Commit

Permalink
sys: do not link against native lib in doc build
Browse files Browse the repository at this point in the history
the libdisplay-info native library is not available
in the docs.rs build environment.
we can just skip linking in this case as we do not
need it for building the documentation
  • Loading branch information
cmeissl committed Jan 6, 2025
1 parent 367fda6 commit fb9f40f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libdisplay-info-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["api-bindings"]
description = "Low-level bindings for libdisplay-info."
documentation = "https://docs.rs/libdisplay-info-sys/"
edition = "2021"
version = "0.2.0"
version = "0.2.1"
keywords = ["libdisplay", "DisplayID", "EDID"]
license = "MIT"
name = "libdisplay-info-sys"
Expand Down
7 changes: 7 additions & 0 deletions libdisplay-info-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
fn main() {
if std::env::var("DOCS_RS").is_ok() {
// don't link against unavailable native lib in doc.rs builds and
// just assume the highest version is available
println!("cargo:rustc-cfg=feature=\"v0_2\"");
return;
}

let deps = system_deps::Config::new().probe().unwrap();
let native_lib = deps.get_by_name("libdisplay-info").unwrap();
let native_version = semver::Version::parse(&native_lib.version).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions libdisplay-info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["api-bindings"]
description = "EDID and DisplayID library."
documentation = "https://docs.rs/libdisplay-info/"
edition = "2021"
version = "0.2.0"
version = "0.2.1"
keywords = ["libdisplay", "DisplayID", "EDID"]
license = "MIT"
name = "libdisplay-info"
Expand All @@ -17,7 +17,7 @@ readme = "../README.md"
v0_2 = ["libdisplay-info-sys/v0_2"]

[dependencies]
libdisplay-info-sys = { version = "0.2.0", path = "../libdisplay-info-sys" }
libdisplay-info-sys = { version = "0.2.1", path = "../libdisplay-info-sys" }
libc = "0.2.155"
thiserror = "2.0.9"
libdisplay-info-derive = { version = "0.1.0", path = "../libdisplay-info-derive" }
Expand Down

0 comments on commit fb9f40f

Please sign in to comment.