From 0c1c9af5ab00f671e303e69d49ea3b7577631335 Mon Sep 17 00:00:00 2001 From: Jhen-Jie Hong Date: Tue, 31 Dec 2024 10:02:23 +0800 Subject: [PATCH] fix: windows build --- CMakeLists.txt | 5 +++++ scripts/ggml-cpu-CMakeLists.txt.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 scripts/ggml-cpu-CMakeLists.txt.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cda20d..8c865bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,11 @@ project (llama-node) set(CMAKE_CXX_STANDARD 17) +execute_process(COMMAND + git apply ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ggml-cpu-CMakeLists.txt.patch + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + if(NOT DEFINED napi_build_version) set(napi_build_version 6) endif() diff --git a/scripts/ggml-cpu-CMakeLists.txt.patch b/scripts/ggml-cpu-CMakeLists.txt.patch new file mode 100644 index 0000000..c5793db --- /dev/null +++ b/scripts/ggml-cpu-CMakeLists.txt.patch @@ -0,0 +1,13 @@ +diff --git a/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt b/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt +index f0aecac1..53dffd55 100644 +--- a/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt ++++ b/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt +@@ -80,7 +80,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name) + message(STATUS "ARM detected") + + if (MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") +- message(FATAL_ERROR "MSVC is not supported for ARM, use clang") ++ list(APPEND ARCH_FLAGS /arch:armv8.7) + else() + check_cxx_compiler_flag(-mfp16-format=ieee GGML_COMPILER_SUPPORTS_FP16_FORMAT_I3E) + if (NOT "${GGML_COMPILER_SUPPORTS_FP16_FORMAT_I3E}" STREQUAL "")