@@ -11,6 +11,7 @@ LLAMA_BUILD_EXAMPLES=OFF
11
11
LLAMA_BUILD_TOOLS=OFF
12
12
LLAMA_BUILD_TESTS=OFF
13
13
LLAMA_BUILD_SERVER=OFF
14
+ LLAMA_BUILD_COMMON=ON
14
15
GGML_METAL=ON
15
16
GGML_METAL_EMBED_LIBRARY=ON
16
17
GGML_BLAS_DEFAULT=ON
@@ -35,6 +36,7 @@ COMMON_CMAKE_ARGS=(
35
36
-DLLAMA_BUILD_TOOLS=${LLAMA_BUILD_TOOLS}
36
37
-DLLAMA_BUILD_TESTS=${LLAMA_BUILD_TESTS}
37
38
-DLLAMA_BUILD_SERVER=${LLAMA_BUILD_SERVER}
39
+ -DLLAMA_BUILD_COMMON=${LLAMA_BUILD_COMMON}
38
40
-DGGML_METAL_EMBED_LIBRARY=${GGML_METAL_EMBED_LIBRARY}
39
41
-DGGML_BLAS_DEFAULT=${GGML_BLAS_DEFAULT}
40
42
-DGGML_METAL=${GGML_METAL}
@@ -116,6 +118,7 @@ setup_framework_structure() {
116
118
117
119
# Copy all required headers (common for all platforms)
118
120
cp include/llama.h ${header_path}
121
+ cp include/llama-cpp.h ${header_path}
119
122
cp ggml/include/ggml.h ${header_path}
120
123
cp ggml/include/ggml-opt.h ${header_path}
121
124
cp ggml/include/ggml-alloc.h ${header_path}
@@ -124,18 +127,29 @@ setup_framework_structure() {
124
127
cp ggml/include/ggml-cpu.h ${header_path}
125
128
cp ggml/include/ggml-blas.h ${header_path}
126
129
cp ggml/include/gguf.h ${header_path}
130
+ cp tools/mtmd/mtmd.h ${header_path}
131
+ cp tools/mtmd/clip.h ${header_path}
132
+ cp common/common.h ${header_path}
133
+ cp common/chat.h ${header_path}
134
+ cp common/sampling.h ${header_path}
127
135
128
136
# Create module map (common for all platforms)
129
137
cat > ${module_path} module.modulemap << EOF
130
138
framework module llama {
131
139
header "llama.h"
140
+ header "llama-cpp.h"
132
141
header "ggml.h"
133
142
header "ggml-alloc.h"
134
143
header "ggml-backend.h"
135
144
header "ggml-metal.h"
136
145
header "ggml-cpu.h"
137
146
header "ggml-blas.h"
138
147
header "gguf.h"
148
+ header "mtmd.h"
149
+ header "clip.h"
150
+ header "common.h"
151
+ header "chat.h"
152
+ header "sampling.h"
139
153
140
154
link "c++"
141
155
link framework "Accelerate"
@@ -235,6 +249,9 @@ combine_static_libraries() {
235
249
local base_dir=" $( pwd) "
236
250
local framework_name=" llama"
237
251
252
+ echo " Debug: Building for ${platform} (simulator: ${is_simulator} )"
253
+ echo " Debug: Looking for libraries in ${build_dir} /${release_dir} "
254
+
238
255
# Determine output path based on platform
239
256
local output_lib=" "
240
257
if [[ " $platform " == " macos" ]]; then
@@ -252,8 +269,21 @@ combine_static_libraries() {
252
269
" ${base_dir} /${build_dir} /ggml/src/${release_dir} /libggml-cpu.a"
253
270
" ${base_dir} /${build_dir} /ggml/src/ggml-metal/${release_dir} /libggml-metal.a"
254
271
" ${base_dir} /${build_dir} /ggml/src/ggml-blas/${release_dir} /libggml-blas.a"
272
+ " ${base_dir} /${build_dir} /build/mtmd.build/${release_dir} /libmtmd.a"
273
+ " ${base_dir} /${build_dir} /common/${release_dir} /libcommon.a"
255
274
)
256
275
276
+ # Debug: Check if each library exists
277
+ for lib in " ${libs[@]} " ; do
278
+ if [ -f " $lib " ]; then
279
+ echo " Debug: Found library: $lib "
280
+ else
281
+ echo " Debug: Missing library: $lib "
282
+ echo " Debug: Directory contents:"
283
+ dirname " $lib " | xargs ls -la 2> /dev/null || echo " Directory does not exist"
284
+ fi
285
+ done
286
+
257
287
# Create temporary directory for processing
258
288
local temp_dir=" ${base_dir} /${build_dir} /temp"
259
289
mkdir -p " ${temp_dir} "
@@ -529,7 +559,7 @@ xcodebuild -create-xcframework \
529
559
-framework $( pwd) /build-ios-device/framework/llama.framework \
530
560
-debug-symbols $( pwd) /build-ios-device/dSYMs/llama.dSYM \
531
561
-framework $( pwd) /build-macos/framework/llama.framework \
532
- -debug-symbols $( pwd) /build-macos/dSYMS /llama.dSYM \
562
+ -debug-symbols $( pwd) /build-macos/dSYMs /llama.dSYM \
533
563
-framework $( pwd) /build-visionos/framework/llama.framework \
534
564
-debug-symbols $( pwd) /build-visionos/dSYMs/llama.dSYM \
535
565
-framework $( pwd) /build-visionos-sim/framework/llama.framework \
0 commit comments