Fix windows cuda build

* add ggml-cuda.cu
* sort out linker paths using CUDA_PATH
This commit is contained in:
Jonathan Newnham 2023-05-25 11:39:33 +12:00 committed by jnnnnn
parent 93f8d92d56
commit 435a736af1
No known key found for this signature in database
2 changed files with 14 additions and 3 deletions

View file

@ -17,6 +17,8 @@ include = [
"whisper.cpp/ggml.h",
"whisper.cpp/ggml-opencl.c",
"whisper.cpp/ggml-opencl.h",
"whisper.cpp/ggml-cuda.cu",
"whisper.cpp/ggml-cuda.h",
"whisper.cpp/LICENSE",
"whisper.cpp/whisper.cpp",
"whisper.cpp/whisper.h",

View file

@ -34,11 +34,20 @@ fn main() {
#[cfg(feature = "cuda")]
{
println!("cargo:rustc-link-lib=cublas");
println!("cargo:rustc-link-lib=culibos");
println!("cargo:rustc-link-lib=cudart");
println!("cargo:rustc-link-lib=cublasLt");
#[cfg(target_os = "windows")]
{
let cuda_path = PathBuf::from(env::var("CUDA_PATH").unwrap()).join("lib/x64");
println!("cargo:rustc-link-search={}", cuda_path.display());
}
#[cfg(not(target_os = "windows"))]
{
println!("cargo:rustc-link-lib=culibos");
println!("cargo:rustc-link-search=/usr/local/cuda/lib64");
println!("cargo:rustc-link-search=/opt/cuda/lib64");
}
}
println!("cargo:rerun-if-changed=wrapper.h");