Skip to content

Commit 5b35894

Browse files
committed
removed cuda dep if feature not enabled
1 parent 5b2b845 commit 5b35894

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

llama-cpp-sys-2/build.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ fn main() {
1212
.define("_GNU_SOURCE", Some("1"))
1313
.compile("ggml");
1414

15-
cc::Build::new()
16-
.cuda(true)
17-
.include("llama.cpp")
18-
.file("llama.cpp/ggml-cuda.cu")
19-
.compile("ggml-cuda");
15+
if cublas_enabled {
16+
cc::Build::new()
17+
.cuda(true)
18+
.include("llama.cpp")
19+
.file("llama.cpp/ggml-cuda.cu")
20+
.compile("ggml-cuda");
21+
}
2022

2123
cc::Build::new()
2224
.include("llama.cpp")
@@ -33,11 +35,19 @@ fn main() {
3335
.file("llama.cpp/ggml-quants.c")
3436
.compile("ggml-quants");
3537

36-
cc::Build::new()
38+
let mut llama_build = cc::Build::new();
39+
40+
llama_build
3741
.cpp(true)
38-
.include("llama.cpp")
39-
.define("GGML_USE_CUBLAS", if cublas_enabled { Some("1") } else { None })
40-
.cuda(cublas_enabled)
42+
.include("llama.cpp");
43+
44+
if cublas_enabled {
45+
llama_build
46+
.define("GGML_USE_CUBLAS", None)
47+
.cuda(true);
48+
}
49+
50+
llama_build
4151
.file("llama.cpp/llama.cpp")
4252
.compile("llama");
4353

0 commit comments

Comments
 (0)