Skip to content

Commit b4c6f46

Browse files
authored
Allow cmake to build ggml as a library (#1896)
* Allow cmake to build ggml as a library * A ggml_static library will be created * When BUILD_SHARED_LIBS is enabled, ggml_shared will also be built
1 parent 92f20d9 commit b4c6f46

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
461461
target_compile_features(ggml PUBLIC c_std_11) # don't bump
462462
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})
463463

464+
add_library(ggml_static STATIC $<TARGET_OBJECTS:ggml>)
464465
if (BUILD_SHARED_LIBS)
465466
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
467+
add_library(ggml_shared SHARED $<TARGET_OBJECTS:ggml>)
466468
endif()
467469

468470
add_library(llama

0 commit comments

Comments
 (0)