Skip to content

Commit

Permalink
better warning msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanting Zhang committed Jan 23, 2024
1 parent 498c207 commit 61d0623
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ fn main() {
println!("cargo:rerun-if-env-changed=CXXFLAGS");
println!("cargo:rustc-cfg=feature=\"cuda\"");
} else {
println!("warning=feature \"cuda\" was enabled but no valid installation of CUDA was found");
println!("warning=the crate's default CPU methods will be compiled instead; NO GPU IMPLEMENTATION WILL USED WHEN CALLING THIS CRATE'S METHODS");
println!("warning=please recompile without feature \"cuda\" or provide a valid CUDA configuration");
println!("cargo:warning=feature \"cuda\" was enabled but no valid installation of CUDA was found");
println!("cargo:warning=the crate's default CPU methods will be compiled instead; NO GPU IMPLEMENTATION WILL BE USED WHEN CALLING THIS CRATE'S METHODS");
println!("cargo:warning=please recompile without feature \"cuda\" or provide a valid CUDA installation");
}
println!("cargo:rerun-if-env-changed=NVCC");
}
Expand Down Expand Up @@ -103,13 +103,15 @@ fn determine_cc_def(target_arch: &str, default_def: &str) -> Option<String> {
None
}

#[cfg(feature = "cuda")]
fn cuda_available() -> bool {
match env::var("NVCC") {
Ok(var) => which::which(var).is_ok(),
Err(_) => which::which("nvcc").is_ok(),
}
}

#[cfg(feature = "cuda")]
fn compile_cuda(file_name: &str, output_name: &str, implement_sort: bool) {
let mut nvcc = cc::Build::new();
nvcc.cuda(true);
Expand Down

0 comments on commit 61d0623

Please sign in to comment.