Skip to content

Commit

Permalink
Better cuda build.rs linking (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Jun 24, 2024
1 parent 333ce88 commit 3febef2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mistralrs-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ fn main() {
println!("cargo:rustc-link-search={}", build_dir.display());
println!("cargo:rustc-link-lib=mistralcuda");
println!("cargo:rustc-link-lib=dylib=cudart");
println!("cargo:rustc-link-lib=dylib=stdc++");

let target = std::env::var("TARGET").unwrap();
if target.contains("msvc") {
// nothing to link to
} else if target.contains("apple")
|| target.contains("freebsd")
|| target.contains("openbsd")
{
println!("cargo:rustc-link-lib=dylib=c++");
} else if target.contains("android") {
println!("cargo:rustc-link-lib=dylib=c++_shared");
} else {
println!("cargo:rustc-link-lib=dylib=stdc++");
}
}
}

0 comments on commit 3febef2

Please sign in to comment.