1
1
# mtmd
2
2
3
- add_library (mtmd OBJECT
3
+ find_package (Threads REQUIRED )
4
+
5
+ add_library (mtmd
4
6
mtmd.cpp
5
7
mtmd-audio.cpp
6
8
mtmd.h
7
9
clip.cpp
8
10
clip.h
9
11
clip-impl.h
10
- )
11
-
12
- target_link_libraries (mtmd PRIVATE ggml llama ${CMAKE_THREAD_LIBS_INIT} )
13
- target_include_directories (mtmd PUBLIC . )
14
- target_include_directories (mtmd PRIVATE ../.. )
15
- target_compile_features (mtmd PRIVATE cxx_std_17 )
16
-
17
- # compile the helper separately, to avoid long compile times with miniaudio.h and stb_image.h
18
-
19
- add_library (mtmd_helper OBJECT
20
12
mtmd-helper.cpp
21
13
mtmd-helper.h
22
14
)
23
15
24
- target_link_libraries (mtmd_helper PRIVATE ggml llama mtmd ${CMAKE_THREAD_LIBS_INIT} )
25
- target_include_directories (mtmd_helper PUBLIC . )
26
- target_include_directories (mtmd_helper PRIVATE ../../vendor )
27
- target_compile_features (mtmd_helper PRIVATE cxx_std_17 )
16
+ target_link_libraries (mtmd PUBLIC ggml llama )
17
+ target_link_libraries (mtmd PRIVATE Threads::Threads )
18
+ target_include_directories (mtmd PUBLIC . )
19
+ target_include_directories (mtmd PRIVATE ../.. )
20
+ target_include_directories (mtmd PRIVATE ../../vendor )
21
+ target_compile_features (mtmd PRIVATE cxx_std_17 )
28
22
29
23
if (BUILD_SHARED_LIBS )
30
- set_target_properties (mtmd PROPERTIES POSITION_INDEPENDENT_CODE ON )
31
- target_compile_definitions (mtmd PRIVATE LLAMA_SHARED LLAMA_BUILD )
32
- add_library (mtmd_shared SHARED $< TARGET_OBJECTS:mtmd> )
33
- target_link_libraries (mtmd_shared PRIVATE ggml llama ${CMAKE_THREAD_LIBS_INIT} )
34
- install (TARGETS mtmd_shared LIBRARY )
35
-
36
- set_target_properties (mtmd_helper PROPERTIES POSITION_INDEPENDENT_CODE ON )
37
- target_compile_definitions (mtmd_helper PRIVATE LLAMA_SHARED LLAMA_BUILD )
38
- add_library (mtmd_helper_shared SHARED $< TARGET_OBJECTS:mtmd> )
39
- target_link_libraries (mtmd_helper_shared PRIVATE ggml llama mtmd ${CMAKE_THREAD_LIBS_INIT} )
40
- install (TARGETS mtmd_helper_shared LIBRARY )
24
+ set_target_properties (mtmd PROPERTIES POSITION_INDEPENDENT_CODE ON )
25
+ target_compile_definitions (mtmd PRIVATE LLAMA_BUILD )
26
+ target_compile_definitions (mtmd PUBLIC LLAMA_SHARED )
41
27
endif ()
42
28
29
+ set (MTMD_PUBLIC_HEADERS
30
+ ${CMAKE_CURRENT_SOURCE_DIR} /mtmd.h
31
+ ${CMAKE_CURRENT_SOURCE_DIR} /mtmd-helper.h
32
+ )
33
+
34
+ set_target_properties (mtmd
35
+ PROPERTIES
36
+ PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS} " )
37
+
38
+ install (TARGETS mtmd LIBRARY PUBLIC_HEADER )
39
+
43
40
if (NOT MSVC )
44
41
# for stb_image.h and miniaudio.h
45
- target_compile_options (mtmd_helper PRIVATE -Wno-cast-qual )
42
+ target_compile_options (mtmd PRIVATE -Wno-cast-qual )
46
43
endif ()
47
44
48
- if (TARGET BUILD_INFO )
49
- add_dependencies (mtmd BUILD_INFO )
50
- add_dependencies (mtmd_helper BUILD_INFO )
45
+ if (TARGET BUILD_INFO )
46
+ add_dependencies (mtmd BUILD_INFO )
47
+ add_dependencies (mtmd-helper BUILD_INFO )
51
48
endif ()
52
49
53
50
add_executable (llama-llava-cli deprecation-warning.cpp )
@@ -56,8 +53,8 @@ add_executable(llama-minicpmv-cli deprecation-warning.cpp)
56
53
add_executable (llama-qwen2vl-cli deprecation-warning.cpp )
57
54
58
55
set (TARGET llama-mtmd-cli )
59
- add_executable (${TARGET} mtmd-cli.cpp )
60
- set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME llama-mtmd-cli )
61
- install (TARGETS ${TARGET} RUNTIME )
62
- target_link_libraries (${TARGET} PRIVATE common mtmd mtmd_helper ${CMAKE_THREAD_LIBS_INIT} )
56
+ add_executable (${TARGET} mtmd-cli.cpp )
57
+ set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME llama-mtmd-cli )
58
+ install (TARGETS ${TARGET} RUNTIME )
59
+ target_link_libraries (${TARGET} PRIVATE common mtmd Threads::Threads )
63
60
target_compile_features (${TARGET} PRIVATE cxx_std_17 )
0 commit comments