@@ -457,7 +457,7 @@ fn compile_cuda(cx: &mut Build, cxx: &mut Build, featless_cxx: Build) -> &'stati
457
457
let lib_name = "ggml-cuda" ;
458
458
let ggml_path = LLAMA_PATH . join ( "ggml" ) ;
459
459
let ggml_src = ggml_path. join ( "src" ) ;
460
- let cuda_path = ggml_src. join ( "ggml-cuda" ) ;
460
+ let cuda_path = ggml_src. join ( lib_name ) ;
461
461
let cuda_sources = read_dir ( cuda_path. as_path ( ) )
462
462
. unwrap ( )
463
463
. map ( |f| f. unwrap ( ) )
@@ -497,15 +497,19 @@ fn compile_metal(cx: &mut Build, cxx: &mut Build) {
497
497
// It's idiomatic to use OUT_DIR for intermediate c/c++ artifacts
498
498
let out_dir = env:: var ( "OUT_DIR" ) . unwrap ( ) ;
499
499
500
- let ggml_metal_shader_path = LLAMA_PATH . join ( "ggml-metal.metal" ) ;
500
+ let lib_name = "ggml-metal.metal" ;
501
+ let ggml_path = LLAMA_PATH . join ( "ggml" ) ;
502
+ let ggml_src = ggml_path. join ( "src" ) ;
503
+ let ggml_include = ggml_path. join ( "include" ) ;
504
+ let ggml_metal_shader_path = ggml_src. join ( lib_name) ;
501
505
502
506
// Create a temporary assembly file that will allow for static linking to the metal shader.
503
507
let ggml_metal_embed_assembly_path = PathBuf :: from ( & out_dir) . join ( "ggml-metal-embed.asm" ) ;
504
508
let mut ggml_metal_embed_assembly_file = File :: create ( & ggml_metal_embed_assembly_path)
505
509
. expect ( "Failed to open ggml-metal-embed.asm file" ) ;
506
510
507
- let ggml_metal_shader_out_path = PathBuf :: from ( & out_dir) . join ( "ggml-metal.metal" ) ;
508
- let common = LLAMA_PATH . join ( "ggml-common.h" ) ;
511
+ let ggml_metal_shader_out_path = PathBuf :: from ( & out_dir) . join ( lib_name ) ;
512
+ let common = ggml_src . join ( "ggml-common.h" ) ;
509
513
510
514
let input_file = File :: open ( ggml_metal_shader_path) . expect ( "Failed to open input file" ) ;
511
515
let output_file =
@@ -580,8 +584,8 @@ fn compile_metal(cx: &mut Build, cxx: &mut Build) {
580
584
println ! ( "cargo:rustc-link-search=native={}" , & out_dir) ;
581
585
println ! ( "cargo:rustc-link-lib=static=ggml-metal-embed" ) ;
582
586
583
- cx. include ( LLAMA_PATH . join ( "ggml-metal.h" ) )
584
- . file ( LLAMA_PATH . join ( "ggml-metal.m" ) ) ;
587
+ cx. include ( ggml_include . join ( "ggml-metal.h" ) )
588
+ . file ( ggml_src . join ( "ggml-metal.m" ) ) ;
585
589
}
586
590
587
591
fn find_windows_vulkan_sdk ( ) -> PathBuf {
0 commit comments