]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Allow cmake to build ggml as a library (#1896)
authorKerfuffle <redacted>
Sat, 17 Jun 2023 07:49:42 +0000 (01:49 -0600)
committerGitHub <redacted>
Sat, 17 Jun 2023 07:49:42 +0000 (01:49 -0600)
* 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

CMakeLists.txt

index 935fba838d3aeb7475cefa95aa214d78547a2f45..f5a968533b022359b99b1ddff471373f59a55c63 100644 (file)
@@ -461,8 +461,10 @@ target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
 target_compile_features(ggml PUBLIC c_std_11) # don't bump
 target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})
 
+add_library(ggml_static STATIC $<TARGET_OBJECTS:ggml>)
 if (BUILD_SHARED_LIBS)
     set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
+    add_library(ggml_shared SHARED $<TARGET_OBJECTS:ggml>)
 endif()
 
 add_library(llama