char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
f3a184b15
char/aliceai-t5-moe
1# mtmd 2 3set ( MTMD_VIDEO_HELP "enable video support in mtmd (requires ffmpeg binary in PATH)" ) 4 5set ( MTMD_VIDEO ON CACHE BOOL " ${ MTMD_VIDEO_HELP } " ) 6# TODO: add MTMD_VIDEO_METHOD in the future to select between ffmpeg and other backends 7 8if ( MTMD_VIDEOAND NOT LLAMA_SUBPROCESS) 9message ( STATUS "Disabling MTMD_VIDEO because LLAMA_SUBPROCESS is OFF" ) 10set ( MTMD_VIDEO OFF CACHE BOOL " ${ MTMD_VIDEO_HELP } " FORCE ) 11endif () 12 13find_package ( Threads REQUIRED ) 14 15add_library ( mtmd 16mtmd.cpp 17mtmd-audio.cpp 18mtmd-image.cpp 19mtmd.h 20mtmd-internal.h 21mtmd-helper.cpp 22mtmd-helper-gen.cpp 23mtmd-helper-common.h 24mtmd-helper.h 25clip.cpp 26clip.h 27clip-impl.h 28clip-model.h 29clip-graph.h 30models/models.h 31models/cogvlm.cpp 32models/conformer.cpp 33models/deepseek4v.cpp 34models/dots3note.cpp 35models/dotsocr.cpp 36models/exaone4_5.cpp 37models/gemma4a.cpp 38models/gemma4v.cpp 39models/gemma4ua.cpp 40models/gemma4uv.cpp 41models/glm4v.cpp 42models/granite-speech.cpp 43models/granite4-vision.cpp 44models/hunyuanvl.cpp 45models/internvl.cpp 46models/kimivl.cpp 47models/kimik25.cpp 48models/nemotron-v2-vl.cpp 49models/muse-glimmer.cpp 50models/llama4.cpp 51models/llava.cpp 52models/minicpmv.cpp 53models/paddleocr.cpp 54models/pixtral.cpp 55models/qwen2vl.cpp 56models/minimax-m3.cpp 57models/qwen3vl.cpp 58models/mimovl.cpp 59models/qwen3a.cpp 60models/mimo-audio.cpp 61models/qwen3tts-spkenc.cpp 62models/qwen3tts-gen.cpp 63models/pockettts-seanet.cpp 64models/pockettts-spkenc.cpp 65models/pockettts-gen.cpp 66models/step3vl.cpp 67models/siglip.cpp 68models/whisper-enc.cpp 69models/deepseekocr.cpp 70models/deepseekocr2.cpp 71models/mobilenetv5.cpp 72models/youtuvl.cpp 73models/yasa2.cpp 74models/parakeet.cpp 75) 76 77set_target_properties ( mtmd PROPERTIES 78VERSION ${ LLAMA_VERSION_BASE } 79SOVERSION ${ LLAMA_VERSION_MAJOR } 80MACHO_CURRENT_VERSION 0 # keep macOS linker from seeing oversized version number 81) 82 83target_link_libraries ( mtmd PUBLIC ggml llama ) 84target_link_libraries ( mtmd PRIVATE Threads::Threads vendor::hash vendor::miniaudio vendor::stb vendor::sheredom ) 85target_include_directories ( mtmd PUBLIC . ) 86target_compile_features ( mtmd PRIVATE cxx_std_17 ) 87 88if ( MTMD_VIDEO) 89target_compile_definitions ( mtmd PRIVATE MTMD_VIDEO ) 90endif () 91 92if ( BUILD_SHARED_LIBS) 93set_target_properties ( mtmd PROPERTIES POSITION_INDEPENDENT_CODE ON ) 94target_compile_definitions ( mtmd PRIVATE LLAMA_BUILD ) 95target_compile_definitions ( mtmd PUBLIC LLAMA_SHARED ) 96 97# export all symbols so that internal components can be tested by test-mtmd-impl 98set_target_properties ( mtmd PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON ) 99endif () 100 101set ( MTMD_PUBLIC_HEADERS 102${ CMAKE_CURRENT_SOURCE_DIR } /mtmd.h 103${ CMAKE_CURRENT_SOURCE_DIR } /mtmd-helper.h 104) 105 106set_target_properties ( mtmd 107PROPERTIES 108PUBLIC_HEADER " ${ MTMD_PUBLIC_HEADERS } " ) 109 110set_target_properties ( mtmd 111PROPERTIES 112PRIVATE_HEADER debug/mtmd-debug.h ) 113 114install ( TARGETS mtmd LIBRARY PUBLIC_HEADER ) 115 116if ( NOT MSVC) 117# for stb_image.h and miniaudio.h 118target_compile_options ( mtmd PRIVATE -Wno-cast-qual ) 119endif () 120 121if ( ANDROID) 122# miniaudio.h defines ma_android_sdk_version() without a prior prototype 123target_compile_options ( mtmd PRIVATE -Wno-missing-prototypes ) 124endif () 125 126if ( TARGET BUILD_INFO) 127add_dependencies ( mtmd BUILD_INFO ) 128add_dependencies ( mtmd-helper BUILD_INFO ) 129endif () 130 131# if mtmd is linked against llama-common, we throw an error 132if ( TARGET mtmd) 133get_target_property ( libs mtmd LINK_LIBRARIES ) 134if ( libsAND "llama-common" IN_LIST libs) 135message ( FATAL_ERROR "mtmd is designed to be a public library.\n" 136"It must not link against llama-common" ) 137endif () 138endif () 139 140# Gate CLI binaries on LLAMA_BUILD_TOOLS so that standalone library-only 141# builds (LLAMA_BUILD_MTMD=ON with LLAMA_BUILD_TOOLS=OFF — e.g. Apple 142# XCFramework packaging) skip the executables entirely. LLAMA_BUILD_COMMON 143# defaults to ON in standalone builds, so we cannot rely on it for gating. 144if ( LLAMA_BUILD_TOOLS) 145add_executable ( llama-llava-cli deprecation-warning.cpp ) 146add_executable ( llama-gemma3-cli deprecation-warning.cpp ) 147add_executable ( llama-minicpmv-cli deprecation-warning.cpp ) 148add_executable ( llama-qwen2vl-cli deprecation-warning.cpp ) 149 150set ( TARGET llama-mtmd-cli ) 151add_executable ( $ { TARGET } mtmd-cli.cpp ) 152set_target_properties ( $ { TARGET } PROPERTIES OUTPUT_NAME llama-mtmd-cli ) 153if ( LLAMA_TOOLS_INSTALL) 154install ( TARGETS ${ TARGET } RUNTIME ) 155endif () 156target_link_libraries ( $ { TARGET } PRIVATE llama-common mtmd Threads::Threads ) 157target_compile_features ( $ { TARGET } PRIVATE cxx_std_17 ) 158 159# mtmd-debug tool 160add_executable ( llama-mtmd-debug debug/mtmd-debug.cpp ) 161set_target_properties ( llama-mtmd-debug PROPERTIES OUTPUT_NAME llama-mtmd-debug ) 162target_link_libraries ( llama-mtmd-debug PRIVATE llama-common mtmd Threads::Threads ) 163target_compile_features ( llama-mtmd-debug PRIVATE cxx_std_17 ) 164endif ()