Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for v2 #10

Merged
merged 7 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: System dependencies
run: sudo apt-get update; sudo apt-get install libdisplay-info-dev
- name: Clippy
run: cargo clippy --all --all-features --all-targets -- -D warnings
run: cargo clippy --all --all-targets -- -D warnings

check-minimal:
env:
Expand Down Expand Up @@ -89,14 +89,14 @@ jobs:
with:
submodules: recursive
- name: Rust toolchain
uses: dtolnay/rust-toolchain@1.65
uses: dtolnay/rust-toolchain@1.70
- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-rust_1.65-${{ hashFiles('**/Cargo.toml') }}
key: ${{ runner.os }}-cargo-rust_1.70-${{ hashFiles('**/Cargo.toml') }}
- name: System dependencies
run: sudo apt-get update; sudo apt-get install libdisplay-info-dev
- name: Check
Expand Down
14 changes: 13 additions & 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.1.0"
version = "0.2.0"
keywords = ["libdisplay", "DisplayID", "EDID"]
license = "MIT"
name = "libdisplay-info-sys"
Expand All @@ -13,4 +13,16 @@ readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
v0_2 = []

[build-dependencies]
system-deps = "7.0.3"
semver = "1.0.24"

[dependencies]

[package.metadata.system-deps.libdisplay-info]
name = "libdisplay-info"
version = ">= 0.1.0, < 0.3.0"
v0_2 = { version = "0.2.0" }
10 changes: 9 additions & 1 deletion libdisplay-info-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
fn main() {
println!("cargo:rustc-link-lib=display-info");
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();
let has_v2 = semver::VersionReq::parse(">=0.2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we error here on >= 0.3, assuming that would be another breaking change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that is probably a good idea. added a commit to restrict the max version directly in the system_deps

.unwrap()
.matches(&native_version);
if has_v2 {
println!("cargo:rustc-cfg=feature=\"v0_2\"");
}
}
Loading
Loading