Skip to content

Commit 2847ecf

Browse files
committed
expose llava methods in libllama.dylib
1 parent 09edb7e commit 2847ecf

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ target_include_directories(llama PUBLIC .)
698698
target_compile_features(llama PUBLIC cxx_std_11) # don't bump
699699
target_link_libraries(llama PRIVATE
700700
ggml
701+
llava
701702
${LLAMA_EXTRA_LIBS}
702703
)
703704

@@ -707,6 +708,22 @@ if (BUILD_SHARED_LIBS)
707708
if (LLAMA_METAL)
708709
set_target_properties(llama PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ggml-metal.metal")
709710
endif()
711+
712+
# By default, symbols provided by the sublibs that are not used by mainlib (which is all of them in this case)
713+
# are not used. This changes that.
714+
if (WIN32)
715+
set_target_properties(llama PROPERTIES
716+
LINK_FLAGS "/WHOLEARCHIVE"
717+
)
718+
elseif (APPLE)
719+
set_target_properties(llama PROPERTIES
720+
LINK_FLAGS "-Wl,-all_load"
721+
)
722+
else ()
723+
set_target_properties(llama PROPERTIES
724+
LINK_FLAGS "-Wl,--whole-archive"
725+
)
726+
endif ()
710727
endif()
711728

712729

llava/CMakeLists.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
set(TARGET llava)
22

3-
if (BUILD_SHARED_LIBS)
4-
add_library(${TARGET} SHARED llava.cpp llava.h clip.cpp clip.h)
5-
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
6-
set_target_properties(${TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
7-
target_link_libraries(${TARGET} PUBLIC Threads::Threads common llama ggml ${LLAMA_EXTRA_LIBS})
8-
install(TARGETS ${TARGET} LIBRARY)
9-
else()
10-
add_library(${TARGET} llava.cpp llava.h clip.cpp clip.h)
11-
target_link_libraries(${TARGET} PRIVATE common llama ggml ${CMAKE_THREAD_LIBS_INIT})
12-
endif()
3+
add_library(${TARGET} STATIC llava.cpp llava.h clip.cpp clip.h)
4+
target_link_libraries(${TARGET} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
135

146
target_include_directories(${TARGET} PUBLIC .)
157
target_include_directories(${TARGET} PUBLIC ..)

0 commit comments

Comments
 (0)