Skip to content

Commit 88261fb

Browse files
authored
[llama_cpp] bump version and install library and header files (#6450)
* [llama_cpp] bump version, also install library and header files * fix umask for installed libs, bump version, add two more programs * fix linkage of example programs on windows, bump version
1 parent 99b0763 commit 88261fb

File tree

2 files changed

+72
-5
lines changed

2 files changed

+72
-5
lines changed

L/llama_cpp/build_tarballs.jl

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using BinaryBuilder, Pkg
22

33
name = "llama_cpp"
4-
version = v"0.0.3" # fake version number
4+
version = v"0.0.4" # fake version number
55

66
# url = "https://github.com/ggerganov/llama.cpp"
77
# description = "Port of Facebook's LLaMA model in C/C++"
@@ -16,19 +16,22 @@ version = v"0.0.3" # fake version number
1616
# 0.0.1 20.03.2023 master-074bea2 https://github.com/ggerganov/llama.cpp/releases/tag/master-074bea2
1717
# 0.0.2 21.03.2023 master-8cf9f34 https://github.com/ggerganov/llama.cpp/releases/tag/master-8cf9f34
1818
# 0.0.3 22.03.2023 master-d5850c5 https://github.com/ggerganov/llama.cpp/releases/tag/master-d5850c5
19+
# 0.0.4 25.03.2023 master-1972616 https://github.com/ggerganov/llama.cpp/releases/tag/master-1972616
1920

2021
sources = [
21-
# 2023.03.22, https://github.com/ggerganov/llama.cpp/releases/tag/master-d5850c5
22-
# fake version = 0.0.3
22+
# fake version = 0.0.4
2323
GitSource("https://github.com/ggerganov/llama.cpp.git",
24-
"d5850c53ca179b9674b98f35d359763416a3cc11"),
24+
"19726169b379bebc96189673a19b89ab1d307659"),
2525
DirectorySource("./bundled"),
2626
]
2727

2828
script = raw"""
2929
cd $WORKSPACE/srcdir/llama.cpp*
3030
3131
atomic_patch -p1 ../patches/cmake-remove-mcpu-native.patch
32+
if [[ "${target}" == *-w64-mingw32* ]]; then
33+
atomic_patch -p1 ../patches/windows-examples-fix-missing-ggml-link.patch
34+
fi
3235
3336
EXTRA_CMAKE_ARGS=
3437
if [[ "${target}" == *-linux-* ]]; then
@@ -40,25 +43,49 @@ cmake .. \
4043
-DCMAKE_INSTALL_PREFIX=$prefix \
4144
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
4245
-DCMAKE_BUILD_TYPE=RELEASE \
46+
-DBUILD_SHARED_LIBS=ON \
47+
-DLLAMA_BUILD_TESTS=OFF \
48+
-DLLAMA_BUILD_EXAMPLES=ON \
49+
-DLLAMA_OPENBLAS=OFF \
4350
-DLLAMA_NATIVE=OFF \
4451
$EXTRA_CMAKE_ARGS
4552
make -j${nproc}
4653
4754
# `make install` doesn't work (2023.03.21)
4855
# make install
49-
for prg in main quantize; do
56+
57+
# executables
58+
for prg in embedding main perplexity quantize; do
5059
install -Dvm 755 "./bin/${prg}${exeext}" "${bindir}/${prg}${exeext}"
5160
done
5261
62+
# libs
63+
for lib in libllama; do
64+
if [[ "${target}" == *-w64-mingw32* ]]; then
65+
install -Dvm 755 "./bin/${lib}.${dlext}" "${libdir}/${lib}.${dlext}"
66+
else
67+
install -Dvm 755 "./${lib}.${dlext}" "${libdir}/${lib}.${dlext}"
68+
fi
69+
done
70+
71+
72+
# header files
73+
for hdr in llama.h ggml.h; do
74+
install -Dvm 644 "../${hdr}" "${includedir}/${hdr}"
75+
done
76+
5377
install_license ../LICENSE
5478
"""
5579

5680
platforms = supported_platforms(; exclude = p -> arch(p) ["i686", "x86_64", "aarch64"])
5781
platforms = expand_cxxstring_abis(platforms)
5882

5983
products = [
84+
ExecutableProduct("embedding", :embedding),
6085
ExecutableProduct("main", :main),
86+
ExecutableProduct("perplexity", :perplexity),
6187
ExecutableProduct("quantize", :quantize),
88+
LibraryProduct("libllama", :libllama),
6289
]
6390

6491
dependencies = Dependency[
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
diff --git a/examples/embedding/CMakeLists.txt b/examples/embedding/CMakeLists.txt
2+
index 88c425d..def5b83 100644
3+
--- a/examples/embedding/CMakeLists.txt
4+
+++ b/examples/embedding/CMakeLists.txt
5+
@@ -1,4 +1,4 @@
6+
set(TARGET embedding)
7+
add_executable(${TARGET} embedding.cpp)
8+
-target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
9+
+target_link_libraries(${TARGET} PRIVATE common llama ggml ${CMAKE_THREAD_LIBS_INIT})
10+
target_compile_features(${TARGET} PRIVATE cxx_std_11)
11+
diff --git a/examples/main/CMakeLists.txt b/examples/main/CMakeLists.txt
12+
index b2dcc29..aa1f794 100644
13+
--- a/examples/main/CMakeLists.txt
14+
+++ b/examples/main/CMakeLists.txt
15+
@@ -1,4 +1,4 @@
16+
set(TARGET main)
17+
add_executable(${TARGET} main.cpp)
18+
-target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
19+
+target_link_libraries(${TARGET} PRIVATE common llama ggml ${CMAKE_THREAD_LIBS_INIT})
20+
target_compile_features(${TARGET} PRIVATE cxx_std_11)
21+
diff --git a/examples/perplexity/CMakeLists.txt b/examples/perplexity/CMakeLists.txt
22+
index 5836df8..9bd8e37 100644
23+
--- a/examples/perplexity/CMakeLists.txt
24+
+++ b/examples/perplexity/CMakeLists.txt
25+
@@ -1,4 +1,4 @@
26+
set(TARGET perplexity)
27+
add_executable(${TARGET} perplexity.cpp)
28+
-target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
29+
+target_link_libraries(${TARGET} PRIVATE common llama ggml ${CMAKE_THREAD_LIBS_INIT})
30+
target_compile_features(${TARGET} PRIVATE cxx_std_11)
31+
diff --git a/examples/quantize/CMakeLists.txt b/examples/quantize/CMakeLists.txt
32+
index fb27d45..17a995b 100644
33+
--- a/examples/quantize/CMakeLists.txt
34+
+++ b/examples/quantize/CMakeLists.txt
35+
@@ -1,4 +1,4 @@
36+
set(TARGET quantize)
37+
add_executable(${TARGET} quantize.cpp)
38+
-target_link_libraries(${TARGET} PRIVATE llama ${CMAKE_THREAD_LIBS_INIT})
39+
+target_link_libraries(${TARGET} PRIVATE llama ggml ${CMAKE_THREAD_LIBS_INIT})
40+
target_compile_features(${TARGET} PRIVATE cxx_std_11)

0 commit comments

Comments
 (0)