From 8558220a84d081e04bbab09625ac3cb09b3c29df Mon Sep 17 00:00:00 2001 From: Olexiy Buyanskyy Date: Thu, 14 Sep 2023 13:36:27 +0300 Subject: [PATCH] improve build for m1 (cherry picked from commit ca32be685405515ba6f8daa93cd3a690ea0329af) --- crates/ggml/sys/build.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/crates/ggml/sys/build.rs b/crates/ggml/sys/build.rs index f69cee3b..736fa156 100644 --- a/crates/ggml/sys/build.rs +++ b/crates/ggml/sys/build.rs @@ -75,17 +75,11 @@ fn main() { } "aarch64" => { if compiler.is_like_clang() || compiler.is_like_gnu() { - if std::env::var("HOST") == std::env::var("TARGET") { + if target_os == "macos" { + build.flag("-mcpu=apple-m1"); + build.flag("-mfpu=neon"); + } else if std::env::var("HOST") == std::env::var("TARGET") { build.flag("-mcpu=native"); - } else { - #[allow(clippy::single_match)] - match target_os.as_str() { - "macos" => { - build.flag("-mcpu=apple-m1"); - build.flag("-mfpu=neon"); - } - _ => {} - } } build.flag("-pthread"); }