Skip to content

Commit

Permalink
respect CUDA_PATH CUDA_INCLUDE_PATH and CUDA_LIB_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Tkachenko committed Jan 16, 2024
1 parent 36ec9e8 commit 9ac0141
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#[cfg(unix)]
fn main() {
let cuda_path = std::env::var("CUDA_PATH").unwrap_or_else(|_| "/usr/local/cuda".to_string());

let cuda_include_path =
std::env::var("CUDA_INCLUDE_PATH").unwrap_or_else(|_| format!("{cuda_path}/include"));

let cuda_lib_path =
std::env::var("CUDA_LIB_PATH").unwrap_or_else(|_| format!("{cuda_path}/lib64"));

cpp_build::Config::new()
.include("/usr/local/cuda/include")
.include(cuda_include_path)
.build("src/lib.rs");
println!("cargo:rustc-link-search=/usr/local/cuda/lib64");

println!("cargo:rustc-link-search={cuda_lib_path}");
println!("cargo:rustc-link-lib=cudart");

#[cfg(feature = "npp")]
link_npp_libraries();
}
Expand Down

0 comments on commit 9ac0141

Please sign in to comment.