Skip to content

Commit 6e4bf3d

Browse files
authored
fix: adapt to llama.cpp breaking changes (#424)
1 parent 314d7e8 commit 6e4bf3d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

llama/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ if(APPLE)
5050
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
5151
else()
5252
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
53+
54+
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
55+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
56+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
57+
set(CMAKE_BUILD_RPATH "$ORIGIN")
58+
set(CMAKE_INSTALL_RPATH "$ORIGIN")
59+
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
60+
endif()
5361
endif()
5462

5563
execute_process(COMMAND node -p "require('node-addon-api').include.slice(1,-1)"

llama/addon/AddonGrammar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AddonGrammar::AddonGrammar(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Ad
1717
}
1818
}
1919

20-
auto parsed_grammar = llama_grammar_init_impl(nullptr, grammarCode.c_str(), rootRuleName.c_str());
20+
auto parsed_grammar = llama_grammar_init_impl(nullptr, grammarCode.c_str(), rootRuleName.c_str(), false, nullptr, 0, nullptr, 0);
2121

2222
// will be empty if there are parse errors
2323
if (parsed_grammar == nullptr) {
@@ -37,7 +37,7 @@ AddonGrammar::~AddonGrammar() {
3737
Napi::Value AddonGrammar::isTextCompatible(const Napi::CallbackInfo& info) {
3838
const std::string testText = info[0].As<Napi::String>().Utf8Value();
3939

40-
auto parsed_grammar = llama_grammar_init_impl(nullptr, grammarCode.c_str(), rootRuleName.c_str());
40+
auto parsed_grammar = llama_grammar_init_impl(nullptr, grammarCode.c_str(), rootRuleName.c_str(), false, nullptr, 0, nullptr, 0);
4141

4242
// will be empty if there are parse errors
4343
if (parsed_grammar == nullptr) {

0 commit comments

Comments
 (0)