Skip to content

Commit 16bd2de

Browse files
committed
Use windows crate to link with required system libraries
1 parent 39de906 commit 16bd2de

3 files changed

Lines changed: 124 additions & 47 deletions

File tree

Cargo.lock

Lines changed: 115 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ pkcs11-bindings = ">= 0.1.3"
2020
strum = { version = "0.27", default-features = false, features = ["derive"] }
2121
thiserror = "2.0.12"
2222

23+
[target.'cfg(windows)'.dependencies]
24+
windows = { version = ">=0.60,<0.63", default-features = false, features = [
25+
"Win32_Foundation",
26+
"Win32_NetworkManagement_IpHelper",
27+
"Win32_NetworkManagement_Ndis",
28+
"Win32_Networking_WinSock",
29+
]}
30+
2331
[build-dependencies]
2432
bindgen = { version = "0.72", default-features = false, features = ["runtime"] }
2533
mozbuild = { version = "0.1", default-features = false, optional = true }
@@ -32,7 +40,7 @@ toml = { version = "0.5", default-features = false }
3240
test-fixture = {path = "test-fixture"}
3341

3442
[package.metadata.cargo-machete]
35-
ignored = ["bindgen", "semver", "serde", "serde_derive", "toml"]
43+
ignored = ["bindgen", "semver", "serde", "serde_derive", "toml", "windows"]
3644

3745
[lints.rust]
3846
absolute_paths_not_starting_with_crate = "warn"

build.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,6 @@ fn process_config(config: &mut HashMap<String, Bindings>) {
544544
fn main() {
545545
println!("cargo:rustc-check-cfg=cfg(nss_nodb)");
546546

547-
if env::consts::OS == "windows" {
548-
println!("cargo:rustc-link-lib=advapi32");
549-
}
550-
551547
let flags = if cfg!(feature = "gecko") {
552548
setup_for_gecko()
553549
} else if let Ok(nss_dir) = env::var("NSS_DIR") {

0 commit comments

Comments
 (0)