aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKerfuffle <44031344+KerfuffleV2@users.noreply.github.com>2023-06-17 01:49:42 -0600
committerGitHub <noreply@github.com>2023-06-17 01:49:42 -0600
commitb4c6f46f17b6e02f1cd55a81339e7e64f3aaa688 (patch)
tree44ca0ae82208a8354d672f88be1a6544c25da14d /CMakeLists.txt
parent92f20d9942c86daeb78637bdad7296a572f4da28 (diff)
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
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 935fba8..f5a9685 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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