Skip to content

Commit bdb8019

Browse files
committed
Bindings: Add llama.cpp dev options to build guide
Also change LLAMACPP_TAG to LLAMACPP_COMMIT Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
1 parent e14a1e7 commit bdb8019

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

BUILDING.md

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ This will invoke CMake to build the bindings and copy the resulting shared libra
4343

4444
Optionally, environment variables can be set for certain architectures when building (ex. CUDA):
4545
- `MAX_JOBS`: Number of parallel jobs (defaults to the number of CPU cores)
46+
- `LLAMACPP_REPO`: Point to a custom repository for llama.cpp (Here be dragons!)
47+
- `LLAMACPP_TAG`: Set a specific tag for llama.cpp (Here be dragons!)
4648
- `GGML_CUDA=1`: Enables CUDA support
4749
- `CMAKE_CUDA_ARCHITECTURES`: Specifies CUDA compute capabilities (defaults to `native` if using CMake > 3.24)
4850
- `GGML_VULKAN=1`: Enables Vulkan Support

bindings/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ 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")
16+
if (DEFINED LLAMACPP_REPO OR DEFINED LLAMACPP_COMMIT)
17+
message(STATUS "Using a custom commit or repo for llama.cpp. Build might not work as expected. Here be dragons!")
18+
endif()
1819

1920
set(LLAMACPP_REPO "https://github.com/ggerganov/llama.cpp.git" CACHE STRING "llama.cpp repository URL")
2021
message(STATUS "Using llama.cpp repo ${LLAMACPP_REPO}")
2122

22-
set(LLAMACPP_TAG ${LLAMACPP_COMMIT} CACHE STRING "llama.cpp repository tag")
23+
# Stable llama.cpp commit for bindings
24+
set(LLAMACPP_COMMIT "84d547554123a62e9ac77107cb20e4f6cc503af4" CACHE STRING "llama.cpp repository commit")
2325
message(STATUS "Using llama.cpp tag ${LLAMACPP_COMMIT}")
2426

2527
# Fetch llama.cpp latest
@@ -28,7 +30,7 @@ include(FetchContent)
2830
FetchContent_Declare(
2931
llama
3032
GIT_REPOSITORY ${LLAMACPP_REPO}
31-
GIT_TAG ${LLAMACPP_TAG}
33+
GIT_TAG ${LLAMACPP_COMMIT}
3234
)
3335

3436
# Required for proper builds

bindings/bindings.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ if ($env:LLAMACPP_REPO) {
1919
Write-Host "Using custom llama.cpp repo: $env:LLAMACPP_REPO"
2020
}
2121

22-
if ($env:LLAMACPP_TAG) {
23-
$extraCmakeArgs += "-DLLAMACPP_REPO=$env:LLAMACPP_TAG"
24-
Write-Host "Using custom llama.cpp tag: $env:LLAMACPP_TAG"
22+
if ($env:LLAMACPP_COMMIT) {
23+
$extraCmakeArgs += "-DLLAMACPP_COMMIT=$env:LLAMACPP_COMMIT"
24+
Write-Host "Using custom llama.cpp commit: $env:LLAMACPP_COMMIT"
2525
}
2626

2727
if ($env:GGML_CUDA -eq 1) {

bindings/bindings.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ if [ -n "$LLAMACPP_REPO" ]; then
2020
echo "Using custom llama.cpp repo: ${LLAMACPP_REPO}"
2121
fi
2222

23-
if [ -n "$LLAMACPP_TAG" ]; then
24-
EXTRA_CMAKE_ARGS+=("-DLLAMACPP_TAG=$LLAMACPP_TAG")
25-
echo "Using custom llama.cpp tag: ${LLAMACPP_TAG}"
23+
if [ -n "$LLAMACPP_COMMIT" ]; then
24+
EXTRA_CMAKE_ARGS+=("-DLLAMACPP_COMMIT=$LLAMACPP_COMMIT")
25+
echo "Using custom llama.cpp commit: ${LLAMACPP_COMMIT}"
2626
fi
2727

2828
if [ "$GGML_CUDA" = "1" ]; then

0 commit comments

Comments
 (0)