1
1
use std:: env;
2
+ use std:: ffi:: OsStr ;
2
3
use std:: path:: Path ;
3
4
use std:: path:: PathBuf ;
4
5
@@ -67,6 +68,12 @@ fn main() {
67
68
. cuda ( true )
68
69
. flag ( "-arch=all" )
69
70
. file ( "llama.cpp/ggml-cuda.cu" )
71
+ . files ( std:: fs:: read_dir ( "llama.cpp/ggml-cuda" )
72
+ . expect ( "failed to read 'llama.cpp/ggml-cuda'" )
73
+ . map ( |e| e. expect ( "failed to ready entry" ) . path ( ) )
74
+ . filter ( |p| p. extension ( ) . is_some_and ( |it| it == OsStr :: new ( "cu" ) ) )
75
+ )
76
+ . include ( "llama.cpp/ggml-cuda" )
70
77
. include ( "llama.cpp" ) ;
71
78
72
79
if ggml_cuda. get_compiler ( ) . is_like_msvc ( ) {
@@ -75,9 +82,9 @@ fn main() {
75
82
ggml_cuda. flag ( "-std=c++11" ) . std ( "c++11" ) ;
76
83
}
77
84
78
- ggml. define ( "GGML_USE_CUBLAS " , None ) ;
79
- ggml_cuda. define ( "GGML_USE_CUBLAS " , None ) ;
80
- llama_cpp. define ( "GGML_USE_CUBLAS " , None ) ;
85
+ ggml. define ( "GGML_USE_CUDA " , None ) ;
86
+ ggml_cuda. define ( "GGML_USE_CUDA " , None ) ;
87
+ llama_cpp. define ( "GGML_USE_CUDA " , None ) ;
81
88
}
82
89
83
90
for build in [ & mut ggml, & mut llama_cpp] {
@@ -177,7 +184,8 @@ fn main() {
177
184
. include ( "llama.cpp" )
178
185
. std ( "c++11" )
179
186
. file ( "llama.cpp/llama.cpp" )
180
- . file ( "llama.cpp/unicode.cpp" ) ;
187
+ . file ( "llama.cpp/unicode.cpp" )
188
+ . file ( "llama.cpp/unicode-data.cpp" ) ;
181
189
182
190
// Remove debug log output from `llama.cpp`
183
191
let is_release = env:: var ( "PROFILE" ) . unwrap ( ) == "release" ;
@@ -193,18 +201,18 @@ fn main() {
193
201
}
194
202
195
203
if let Some ( ggml_cuda) = ggml_cuda {
196
- println ! ( "compiling ggml-cuda" ) ;
204
+ eprintln ! ( "compiling ggml-cuda" ) ;
197
205
ggml_cuda. compile ( "ggml-cuda" ) ;
198
- println ! ( "compiled ggml-cuda" ) ;
206
+ eprintln ! ( "compiled ggml-cuda" ) ;
199
207
}
200
208
201
- println ! ( "compiling ggml" ) ;
209
+ eprintln ! ( "compiling ggml" ) ;
202
210
ggml. compile ( "ggml" ) ;
203
- println ! ( "compiled ggml" ) ;
211
+ eprintln ! ( "compiled ggml" ) ;
204
212
205
- println ! ( "compiling llama" ) ;
213
+ eprintln ! ( "compiling llama" ) ;
206
214
llama_cpp. compile ( "llama" ) ;
207
- println ! ( "compiled llama" ) ;
215
+ eprintln ! ( "compiled llama" ) ;
208
216
209
217
let header = "llama.cpp/llama.h" ;
210
218
0 commit comments