@@ -11,6 +11,7 @@ LLAMA_BUILD_EXAMPLES=OFF
1111LLAMA_BUILD_TOOLS=OFF
1212LLAMA_BUILD_TESTS=OFF
1313LLAMA_BUILD_SERVER=OFF
14+ LLAMA_BUILD_COMMON=ON
1415GGML_METAL=ON
1516GGML_METAL_EMBED_LIBRARY=ON
1617GGML_BLAS_DEFAULT=ON
@@ -35,6 +36,7 @@ COMMON_CMAKE_ARGS=(
3536 -DLLAMA_BUILD_TOOLS=${LLAMA_BUILD_TOOLS}
3637 -DLLAMA_BUILD_TESTS=${LLAMA_BUILD_TESTS}
3738 -DLLAMA_BUILD_SERVER=${LLAMA_BUILD_SERVER}
39+ -DLLAMA_BUILD_COMMON=${LLAMA_BUILD_COMMON}
3840 -DGGML_METAL_EMBED_LIBRARY=${GGML_METAL_EMBED_LIBRARY}
3941 -DGGML_BLAS_DEFAULT=${GGML_BLAS_DEFAULT}
4042 -DGGML_METAL=${GGML_METAL}
@@ -116,6 +118,7 @@ setup_framework_structure() {
116118
117119 # Copy all required headers (common for all platforms)
118120 cp include/llama.h ${header_path}
121+ cp include/llama-cpp.h ${header_path}
119122 cp ggml/include/ggml.h ${header_path}
120123 cp ggml/include/ggml-opt.h ${header_path}
121124 cp ggml/include/ggml-alloc.h ${header_path}
@@ -124,18 +127,29 @@ setup_framework_structure() {
124127 cp ggml/include/ggml-cpu.h ${header_path}
125128 cp ggml/include/ggml-blas.h ${header_path}
126129 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}
127135
128136 # Create module map (common for all platforms)
129137 cat > ${module_path} module.modulemap << EOF
130138framework module llama {
131139 header "llama.h"
140+ header "llama-cpp.h"
132141 header "ggml.h"
133142 header "ggml-alloc.h"
134143 header "ggml-backend.h"
135144 header "ggml-metal.h"
136145 header "ggml-cpu.h"
137146 header "ggml-blas.h"
138147 header "gguf.h"
148+ header "mtmd.h"
149+ header "clip.h"
150+ header "common.h"
151+ header "chat.h"
152+ header "sampling.h"
139153
140154 link "c++"
141155 link framework "Accelerate"
@@ -235,6 +249,9 @@ combine_static_libraries() {
235249 local base_dir=" $( pwd) "
236250 local framework_name=" llama"
237251
252+ echo " Debug: Building for ${platform} (simulator: ${is_simulator} )"
253+ echo " Debug: Looking for libraries in ${build_dir} /${release_dir} "
254+
238255 # Determine output path based on platform
239256 local output_lib=" "
240257 if [[ " $platform " == " macos" ]]; then
@@ -252,8 +269,21 @@ combine_static_libraries() {
252269 " ${base_dir} /${build_dir} /ggml/src/${release_dir} /libggml-cpu.a"
253270 " ${base_dir} /${build_dir} /ggml/src/ggml-metal/${release_dir} /libggml-metal.a"
254271 " ${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"
255274 )
256275
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+
257287 # Create temporary directory for processing
258288 local temp_dir=" ${base_dir} /${build_dir} /temp"
259289 mkdir -p " ${temp_dir} "
@@ -529,7 +559,7 @@ xcodebuild -create-xcframework \
529559 -framework $( pwd) /build-ios-device/framework/llama.framework \
530560 -debug-symbols $( pwd) /build-ios-device/dSYMs/llama.dSYM \
531561 -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 \
533563 -framework $( pwd) /build-visionos/framework/llama.framework \
534564 -debug-symbols $( pwd) /build-visionos/dSYMs/llama.dSYM \
535565 -framework $( pwd) /build-visionos-sim/framework/llama.framework \
0 commit comments