Skip to content

Commit fe6042f

Browse files
committed
Bindings: Add option to set URL and commit of llama.cpp
Users can change this at their own risk when building. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
1 parent e986289 commit fe6042f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

bindings/CMakeLists.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ elseif (UNIX)
1313
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
1414
endif()
1515

16+
# Stable llama.cpp commit for bindings
17+
set(LLAMACPP_COMMIT "84d547554123a62e9ac77107cb20e4f6cc503af4")
18+
19+
set(LLAMACPP_REPO "https://github.com/ggerganov/llama.cpp.git" CACHE STRING "llama.cpp repository URL")
20+
message(STATUS "Using llama.cpp repo ${LLAMACPP_REPO}")
21+
22+
set(LLAMACPP_TAG ${LLAMACPP_COMMIT} CACHE STRING "llama.cpp repository tag")
23+
message(STATUS "Using llama.cpp tag ${LLAMACPP_COMMIT}")
24+
1625
# Fetch llama.cpp latest
1726
# FIXME: Maybe use a vendored llama.cpp build for stability
1827
include(FetchContent)
1928
FetchContent_Declare(
2029
llama
21-
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
22-
GIT_TAG 80a02aa8588ef167d616f76f1781b104c245ace0
30+
GIT_REPOSITORY ${LLAMACPP_REPO}
31+
GIT_TAG ${LLAMACPP_TAG}
2332
)
2433

2534
# Required for proper builds

bindings/bindings.ps1

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ $jobs = if ($env:MAX_JOBS) {
1313

1414
$extraCmakeArgs = @()
1515

16+
# llama.cpp dev options
17+
if ($env:LLAMACPP_REPO) {
18+
$extraCmakeArgs += "-DLLAMACPP_REPO=$env:LLAMACPP_REPO"
19+
Write-Host "Using custom llama.cpp repo: $env:LLAMACPP_REPO"
20+
}
21+
22+
if ($env:LLAMACPP_TAG) {
23+
$extraCmakeArgs += "-DLLAMACPP_REPO=$env:LLAMACPP_TAG"
24+
Write-Host "Using custom llama.cpp tag: $env:LLAMACPP_TAG"
25+
}
26+
1627
if ($env:GGML_CUDA -eq 1) {
1728
Write-Host "CUDA enabled, including in build"
1829

bindings/bindings.sh

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ fi
1414
# Initialize as empty array
1515
EXTRA_CMAKE_ARGS=()
1616

17+
# llama.cpp dev options
18+
if [ -n "$LLAMACPP_REPO" ]; then
19+
EXTRA_CMAKE_ARGS+=("-DLLAMACPP_REPO=$LLAMACPP_REPO")
20+
echo "Using custom llama.cpp repo: ${LLAMACPP_REPO}"
21+
fi
22+
23+
if [ -n "$LLAMACPP_TAG" ]; then
24+
EXTRA_CMAKE_ARGS+=("-DLLAMACPP_TAG=$LLAMACPP_TAG")
25+
echo "Using custom llama.cpp tag: ${LLAMACPP_TAG}"
26+
fi
27+
1728
if [ "$GGML_CUDA" = "1" ]; then
1829
EXTRA_CMAKE_ARGS+=("-DGGML_CUDA=ON")
1930
echo "CUDA enabled, including in build"

0 commit comments

Comments
 (0)