11use std:: env;
2+ use std:: ffi:: OsStr ;
23use std:: path:: Path ;
34use std:: path:: PathBuf ;
45
@@ -67,6 +68,12 @@ fn main() {
6768 . cuda ( true )
6869 . flag ( "-arch=all" )
6970 . 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" )
7077 . include ( "llama.cpp" ) ;
7178
7279 if ggml_cuda. get_compiler ( ) . is_like_msvc ( ) {
@@ -75,9 +82,9 @@ fn main() {
7582 ggml_cuda. flag ( "-std=c++11" ) . std ( "c++11" ) ;
7683 }
7784
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 ) ;
8188 }
8289
8390 for build in [ & mut ggml, & mut llama_cpp] {
@@ -177,7 +184,8 @@ fn main() {
177184 . include ( "llama.cpp" )
178185 . std ( "c++11" )
179186 . file ( "llama.cpp/llama.cpp" )
180- . file ( "llama.cpp/unicode.cpp" ) ;
187+ . file ( "llama.cpp/unicode.cpp" )
188+ . file ( "llama.cpp/unicode-data.cpp" ) ;
181189
182190 // Remove debug log output from `llama.cpp`
183191 let is_release = env:: var ( "PROFILE" ) . unwrap ( ) == "release" ;
@@ -193,18 +201,18 @@ fn main() {
193201 }
194202
195203 if let Some ( ggml_cuda) = ggml_cuda {
196- println ! ( "compiling ggml-cuda" ) ;
204+ eprintln ! ( "compiling ggml-cuda" ) ;
197205 ggml_cuda. compile ( "ggml-cuda" ) ;
198- println ! ( "compiled ggml-cuda" ) ;
206+ eprintln ! ( "compiled ggml-cuda" ) ;
199207 }
200208
201- println ! ( "compiling ggml" ) ;
209+ eprintln ! ( "compiling ggml" ) ;
202210 ggml. compile ( "ggml" ) ;
203- println ! ( "compiled ggml" ) ;
211+ eprintln ! ( "compiled ggml" ) ;
204212
205- println ! ( "compiling llama" ) ;
213+ eprintln ! ( "compiling llama" ) ;
206214 llama_cpp. compile ( "llama" ) ;
207- println ! ( "compiled llama" ) ;
215+ eprintln ! ( "compiled llama" ) ;
208216
209217 let header = "llama.cpp/llama.h" ;
210218
0 commit comments