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