Skip to content

Commit 0af5c68

Browse files
committed
cmake - copy default.metallib to install directory
When metal files are compiled to default.metallib, Cmake needs to add this to the install directory so that it's visible to llama-cpp Also, update package.nix to use absolute path for default.metallib (it's not finding the bundle)
1 parent 973057a commit 0af5c68

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.devops/nix/package.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ effectiveStdenv.mkDerivation (
156156
postPatch = ''
157157
substituteInPlace ./ggml-metal.m \
158158
--replace '[bundle pathForResource:@"ggml-metal" ofType:@"metal"];' "@\"$out/bin/ggml-metal.metal\";"
159+
substituteInPlace ./ggml-metal.m \
160+
--replace '[bundle pathForResource:@"default" ofType:@"metallib"];' "@\"$out/bin/default.metallib\";"
159161
160162
# TODO: Package up each Python script or service appropriately.
161163
# If we were to migrate to buildPythonPackage and prepare the `pyproject.toml`,

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,12 @@ if (LLAMA_METAL)
12601260
GROUP_READ
12611261
WORLD_READ
12621262
DESTINATION ${CMAKE_INSTALL_BINDIR})
1263+
if (NOT LLAMA_METAL_EMBED_LIBRARY)
1264+
install(
1265+
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
1266+
DESTINATION ${CMAKE_INSTALL_BINDIR}
1267+
)
1268+
endif()
12631269
endif()
12641270

12651271
#

0 commit comments

Comments
 (0)