Skip to content

Commit f625a7a

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 2b7033b commit f625a7a

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
@@ -1247,6 +1247,12 @@ if (LLAMA_METAL)
12471247
GROUP_READ
12481248
WORLD_READ
12491249
DESTINATION ${CMAKE_INSTALL_BINDIR})
1250+
if (NOT LLAMA_METAL_EMBED_LIBRARY)
1251+
install(
1252+
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
1253+
DESTINATION ${CMAKE_INSTALL_BINDIR}
1254+
)
1255+
endif()
12501256
endif()
12511257

12521258
#

0 commit comments

Comments
 (0)