Skip to content

Commit

Permalink
update llamacpp dependency management tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
nnance committed Apr 7, 2024
1 parent 09b2ad8 commit d488942
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm run setup
- run: npm ci
- run: npm test

Expand All @@ -27,7 +28,6 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
19 changes: 19 additions & 0 deletions bin/update_submodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Define the repository URL
REPO_URL="https://github.com/ggerganov/llama.cpp.git"

# Define the directory where the repository will be cloned
DIR="llamacpp/lib"

# If the directory already exists, pull the latest changes
if [ -d "$DIR" ]; then
echo "Directory $DIR exists."
echo "Pulling latest changes..."
cd "$DIR" && git pull origin master
else
# If the directory does not exist, clone the repository
echo "Directory $DIR does not exist."
echo "Cloning repository..."
git clone "$REPO_URL" "$DIR"
fi
8 changes: 4 additions & 4 deletions llamacpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ execute_process(COMMAND node -p "require('node-addon-api').include.slice(1,-1)"

include_directories(${NODE_ADDON_API_DIR} ${CMAKE_JS_INC})

add_subdirectory("lib/llamacpp")
include_directories("lib/llamacpp")
include_directories("lib/llamacpp/common")
add_subdirectory("./lib")
include_directories("./lib")
include_directories("./lib/common")

file(GLOB SOURCE_FILES "llamacpp-bindings.cc")

Expand All @@ -33,7 +33,7 @@ target_link_libraries(${PROJECT_NAME} "common")
# copy ggml-metal.metal to release folder
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/lib/llamacpp/ggml-metal.metal
${CMAKE_SOURCE_DIR}/lib/ggml-metal.metal
${CMAKE_CURRENT_BINARY_DIR}/Release/ggml-metal.metal)

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
Expand Down

0 comments on commit d488942

Please sign in to comment.