Skip to content

Commit b6d838a

Browse files
committed
Add the bin dir to cargo's search path on MSVC
That's where it contains the actual dlls needed at runtime
1 parent f9148f9 commit b6d838a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub struct Build {
2222
pub struct Artifacts {
2323
include_dir: PathBuf,
2424
lib_dir: PathBuf,
25+
bin_dir: PathBuf,
2526
libs: Vec<String>,
2627
target: String,
2728
shared: bool,
@@ -412,6 +413,7 @@ impl Build {
412413

413414
Artifacts {
414415
lib_dir: install_dir.join("lib"),
416+
bin_dir: install_dir.join("bin"),
415417
include_dir: install_dir.join("include"),
416418
libs: libs,
417419
target: target.to_string(),
@@ -527,8 +529,12 @@ impl Artifacts {
527529
}
528530
println!("cargo:include={}", self.include_dir.display());
529531
println!("cargo:lib={}", self.lib_dir.display());
530-
if !self.shared && self.target.contains("msvc") {
531-
println!("cargo:rustc-link-lib=user32");
532+
if self.target.contains("msvc") {
533+
if self.shared {
534+
println!("cargo:rustc-link-search=native={}", self.bin_dir.display());
535+
} else {
536+
println!("cargo:rustc-link-lib=user32");
537+
}
532538
}
533539
}
534540
}

0 commit comments

Comments
 (0)