|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index 69da97dc1..e904df95b 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -106,6 +106,8 @@ option(LLAMA_BUILD_COMMON "llama: build common utils library" ${LLAMA_STANDALONE |
| 6 | + # extra artifacts |
| 7 | + option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE}) |
| 8 | + option(LLAMA_BUILD_TOOLS "llama: build tools" ${LLAMA_STANDALONE}) |
| 9 | ++option(LLAMA_BUILD_MTMD "llama: build multimodal library" ${LLAMA_STANDALONE}) |
| 10 | ++option(LLAMA_BUILD_MTMD_CLI "llama: build multimodal CLI tools" ${LLAMA_STANDALONE}) |
| 11 | + option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE}) |
| 12 | + option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE}) |
| 13 | + option(LLAMA_TOOLS_INSTALL "llama: install tools" ${LLAMA_TOOLS_INSTALL_DEFAULT}) |
| 14 | +@@ -212,6 +214,8 @@ endif() |
| 15 | + |
| 16 | + if (LLAMA_BUILD_COMMON AND LLAMA_BUILD_TOOLS) |
| 17 | + add_subdirectory(tools) |
| 18 | ++elseif (LLAMA_BUILD_MTMD) |
| 19 | ++ add_subdirectory(tools/mtmd) |
| 20 | + endif() |
| 21 | + |
| 22 | + # Automatically add all files from the 'licenses' directory |
| 23 | +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt |
| 24 | +index b433c91d8..eaa538127 100644 |
| 25 | +--- a/tools/CMakeLists.txt |
| 26 | ++++ b/tools/CMakeLists.txt |
| 27 | +@@ -28,7 +28,9 @@ else() |
| 28 | + add_subdirectory(tokenize) |
| 29 | + add_subdirectory(parser) |
| 30 | + add_subdirectory(tts) |
| 31 | +- add_subdirectory(mtmd) |
| 32 | ++ if (LLAMA_BUILD_MTMD) |
| 33 | ++ add_subdirectory(mtmd) |
| 34 | ++ endif() |
| 35 | + if (GGML_RPC) |
| 36 | + add_subdirectory(rpc) |
| 37 | + endif() |
| 38 | +diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt |
| 39 | +index 3be3c27e8..2c76babd5 100644 |
| 40 | +--- a/tools/mtmd/CMakeLists.txt |
| 41 | ++++ b/tools/mtmd/CMakeLists.txt |
| 42 | +@@ -62,7 +62,7 @@ set_target_properties(mtmd |
| 43 | + PROPERTIES |
| 44 | + PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS}") |
| 45 | + |
| 46 | +-install(TARGETS mtmd LIBRARY PUBLIC_HEADER) |
| 47 | ++install(TARGETS mtmd LIBRARY ARCHIVE PUBLIC_HEADER) |
| 48 | + |
| 49 | + if (NOT MSVC) |
| 50 | + # for stb_image.h and miniaudio.h |
| 51 | +@@ -71,7 +71,6 @@ endif() |
| 52 | + |
| 53 | + if (TARGET BUILD_INFO) |
| 54 | + add_dependencies(mtmd BUILD_INFO) |
| 55 | +- add_dependencies(mtmd-helper BUILD_INFO) |
| 56 | + endif() |
| 57 | + |
| 58 | + # if mtmd is linked against common, we throw an error |
| 59 | +@@ -83,16 +82,22 @@ if (TARGET mtmd) |
| 60 | + endif() |
| 61 | + endif() |
| 62 | + |
| 63 | +-add_executable(llama-llava-cli deprecation-warning.cpp) |
| 64 | +-add_executable(llama-gemma3-cli deprecation-warning.cpp) |
| 65 | +-add_executable(llama-minicpmv-cli deprecation-warning.cpp) |
| 66 | +-add_executable(llama-qwen2vl-cli deprecation-warning.cpp) |
| 67 | ++if (LLAMA_BUILD_MTMD_CLI) |
| 68 | ++ if (NOT TARGET common) |
| 69 | ++ message(FATAL_ERROR "llama-mtmd-cli requires the common target; enable LLAMA_BUILD_COMMON or disable LLAMA_BUILD_MTMD_CLI") |
| 70 | ++ endif() |
| 71 | + |
| 72 | +-set(TARGET llama-mtmd-cli) |
| 73 | +-add_executable (${TARGET} mtmd-cli.cpp) |
| 74 | +-set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME llama-mtmd-cli) |
| 75 | +-if(LLAMA_TOOLS_INSTALL) |
| 76 | +- install(TARGETS ${TARGET} RUNTIME) |
| 77 | ++ add_executable(llama-llava-cli deprecation-warning.cpp) |
| 78 | ++ add_executable(llama-gemma3-cli deprecation-warning.cpp) |
| 79 | ++ add_executable(llama-minicpmv-cli deprecation-warning.cpp) |
| 80 | ++ add_executable(llama-qwen2vl-cli deprecation-warning.cpp) |
| 81 | ++ |
| 82 | ++ set(TARGET llama-mtmd-cli) |
| 83 | ++ add_executable (${TARGET} mtmd-cli.cpp) |
| 84 | ++ set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME llama-mtmd-cli) |
| 85 | ++ if(LLAMA_TOOLS_INSTALL) |
| 86 | ++ install(TARGETS ${TARGET} RUNTIME) |
| 87 | ++ endif() |
| 88 | ++ target_link_libraries (${TARGET} PRIVATE common mtmd Threads::Threads) |
| 89 | ++ target_compile_features(${TARGET} PRIVATE cxx_std_17) |
| 90 | + endif() |
| 91 | +-target_link_libraries (${TARGET} PRIVATE common mtmd Threads::Threads) |
| 92 | +-target_compile_features(${TARGET} PRIVATE cxx_std_17) |
0 commit comments