Skip to content

Commit

Permalink
fix: windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Dec 31, 2024
1 parent 96e058e commit 0c1c9af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions scripts/ggml-cpu-CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -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 "")

0 comments on commit 0c1c9af

Please sign in to comment.