]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
mtmd: explicitly forbidden inclusion of private header and libcommon (#17946)
authorXuan-Son Nguyen <redacted>
Fri, 12 Dec 2025 14:16:06 +0000 (15:16 +0100)
committerGitHub <redacted>
Fri, 12 Dec 2025 14:16:06 +0000 (15:16 +0100)
tools/mtmd/CMakeLists.txt
tools/mtmd/clip-impl.h
tools/mtmd/clip.h
tools/mtmd/mtmd-audio.h
tools/mtmd/mtmd-helper.cpp

index 13ab7c78f4afceed0b0d950f51c5696e1dae9db4..a104ea1c0ee9c94353533e6d91260f6cada8f6c5 100644 (file)
@@ -53,6 +53,15 @@ if (TARGET BUILD_INFO)
     add_dependencies(mtmd-helper BUILD_INFO)
 endif()
 
+# if mtmd is linked against common, we throw an error
+if (TARGET mtmd)
+    get_target_property(libs mtmd LINK_LIBRARIES)
+    if (libs AND "common" IN_LIST libs)
+        message(FATAL_ERROR "mtmd is designed to be a public library.\n"
+                            "It must not link against common")
+    endif()
+endif()
+
 add_executable(llama-llava-cli    deprecation-warning.cpp)
 add_executable(llama-gemma3-cli   deprecation-warning.cpp)
 add_executable(llama-minicpmv-cli deprecation-warning.cpp)
index cd47865bf4a783a6ad259ad3ccbb2dd769c68c50..e5563eabfc08877a00a975d421c954cadaec0c71 100644 (file)
@@ -13,6 +13,8 @@
 
 // Internal header for clip.cpp
 
+#define MTMD_INTERNAL_HEADER
+
 #define KEY_FTYPE               "general.file_type"
 #define KEY_NAME                "general.name"
 #define KEY_DESCRIPTION         "general.description"
index e8aeb2066c6df61a07587df4efc70b27818e07d7..5aae27a7004347a54d2cdadf500d7b451f85e242 100644 (file)
@@ -7,6 +7,8 @@
 
 // !!! Internal header, to be used by mtmd only !!!
 
+#define MTMD_INTERNAL_HEADER
+
 struct clip_ctx;
 
 struct clip_image_size {
index b7b940affb570f676c445d1e53dd764149c87dbb..0e552347a0a0eccbaa50fef932fac17a00ea8c2a 100644 (file)
@@ -6,6 +6,8 @@
 #include <vector>
 #include <string>
 
+#define MTMD_INTERNAL_HEADER
+
 #define WHISPER_ASSERT GGML_ASSERT
 
 #define WHISPER_SAMPLE_RATE 16000
index f0891bba30dd5d07116336de4769d9071595bc1a..902a4b456d9ca96de4a9ab8ce77c3be24fe2c628 100644 (file)
 #define STB_IMAGE_IMPLEMENTATION
 #include "stb/stb_image.h"
 
+#ifdef MTMD_INTERNAL_HEADER
+#error "mtmd-helper is a public library outside of mtmd. it must not include internal headers"
+#endif
+
 //
 // internal logging functions
 //