-
Notifications
You must be signed in to change notification settings - Fork 13.7k
cmake: mtmd: install PUBLIC_HEADERs and allow static linking (#13902) #13903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,10 @@ add_library(mtmd OBJECT | |
| clip-impl.h | ||
| ) | ||
|
|
||
| set(MTMD_PUBLIC_HEADERS | ||
| "mtmd.h" | ||
| "clip.h") | ||
|
|
||
| target_link_libraries(mtmd PRIVATE ggml llama ${CMAKE_THREAD_LIBS_INIT}) | ||
| target_include_directories(mtmd PUBLIC .) | ||
| target_include_directories(mtmd PRIVATE ../..) | ||
|
|
@@ -21,6 +25,9 @@ add_library(mtmd_helper OBJECT | |
| mtmd-helper.h | ||
| ) | ||
|
|
||
| set(MTMD_HELPER_PUBLIC_HEADERS | ||
| "mtmd-helper.h") | ||
|
|
||
| target_link_libraries(mtmd_helper PRIVATE ggml llama mtmd ${CMAKE_THREAD_LIBS_INIT}) | ||
| target_include_directories(mtmd_helper PUBLIC .) | ||
| target_include_directories(mtmd_helper PRIVATE ./vendor) | ||
|
|
@@ -32,13 +39,22 @@ if (BUILD_SHARED_LIBS) | |
| target_compile_definitions(mtmd PRIVATE LLAMA_SHARED LLAMA_BUILD) | ||
| add_library(mtmd_shared SHARED $<TARGET_OBJECTS:mtmd>) | ||
| target_link_libraries(mtmd_shared PRIVATE ggml llama ${CMAKE_THREAD_LIBS_INIT}) | ||
| install(TARGETS mtmd_shared LIBRARY) | ||
| set_target_properties(mtmd_shared PROPERTIES PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS}") | ||
| install(TARGETS mtmd_shared LIBRARY PUBLIC_HEADER) | ||
|
|
||
| set_target_properties(mtmd_helper PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
| target_compile_definitions(mtmd_helper PRIVATE LLAMA_SHARED LLAMA_BUILD) | ||
| add_library(mtmd_helper_shared SHARED $<TARGET_OBJECTS:mtmd>) | ||
| add_library(mtmd_helper_shared SHARED $<TARGET_OBJECTS:mtmd_helper>) | ||
| target_link_libraries(mtmd_helper_shared PRIVATE ggml llama mtmd ${CMAKE_THREAD_LIBS_INIT}) | ||
| install(TARGETS mtmd_helper_shared LIBRARY) | ||
| set_target_properties(mtmd_helper_shared PROPERTIES PUBLIC_HEADER "${MTMD_HELPER_PUBLIC_HEADERS}") | ||
| install(TARGETS mtmd_helper_shared LIBRARY PUBLIC_HEADER) | ||
| else() | ||
| add_library(mtmd_static STATIC $<TARGET_OBJECTS:mtmd>) | ||
| set_target_properties(mtmd_static PROPERTIES PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS}") | ||
| add_library(mtmd_helper_static STATIC $<TARGET_OBJECTS:mtmd_helper>) | ||
| set_target_properties(mtmd_helper_static PROPERTIES PUBLIC_HEADER "${MTMD_HELPER_PUBLIC_HEADERS}") | ||
| install(TARGETS mtmd_static LIBRARY PUBLIC_HEADER PUBLIC_HEADER) | ||
| install(TARGETS mtmd_helper_static LIBRARY PUBLIC_HEADER) | ||
|
Comment on lines
+51
to
+57
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this may be redundant. If anything in the project need
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for example: So, nothing need to be |
||
| endif() | ||
|
|
||
| if (NOT MSVC) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clip.his not a public header, we should remove it