mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-11-14 11:07:10 +00:00
cmake : add version to all shared object files (#17091)
When compiling llama.cpp in Yocto, it fails QA checks because the generated so files aren't versioned. This applies a version to all generated so files, allowing the package to build without errors.
This commit is contained in:
@@ -211,6 +211,11 @@ add_library(ggml-base
|
|||||||
ggml-quants.h
|
ggml-quants.h
|
||||||
gguf.cpp)
|
gguf.cpp)
|
||||||
|
|
||||||
|
set_target_properties(ggml-base PROPERTIES
|
||||||
|
VERSION ${GGML_VERSION}
|
||||||
|
SOVERSION ${GGML_VERSION_MAJOR}
|
||||||
|
)
|
||||||
|
|
||||||
target_include_directories(ggml-base PRIVATE .)
|
target_include_directories(ggml-base PRIVATE .)
|
||||||
if (GGML_BACKEND_DL)
|
if (GGML_BACKEND_DL)
|
||||||
target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)
|
target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)
|
||||||
@@ -220,6 +225,11 @@ add_library(ggml
|
|||||||
ggml-backend-reg.cpp)
|
ggml-backend-reg.cpp)
|
||||||
add_library(ggml::ggml ALIAS ggml)
|
add_library(ggml::ggml ALIAS ggml)
|
||||||
|
|
||||||
|
set_target_properties(ggml PROPERTIES
|
||||||
|
VERSION ${GGML_VERSION}
|
||||||
|
SOVERSION ${GGML_VERSION_MAJOR}
|
||||||
|
)
|
||||||
|
|
||||||
if (GGML_BACKEND_DIR)
|
if (GGML_BACKEND_DIR)
|
||||||
if (NOT GGML_BACKEND_DL)
|
if (NOT GGML_BACKEND_DL)
|
||||||
message(FATAL_ERROR "GGML_BACKEND_DIR requires GGML_BACKEND_DL")
|
message(FATAL_ERROR "GGML_BACKEND_DIR requires GGML_BACKEND_DL")
|
||||||
@@ -259,6 +269,12 @@ function(ggml_add_backend_library backend)
|
|||||||
target_compile_definitions(${backend} PUBLIC GGML_BACKEND_SHARED)
|
target_compile_definitions(${backend} PUBLIC GGML_BACKEND_SHARED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Set versioning properties for all backend libraries
|
||||||
|
set_target_properties(${backend} PROPERTIES
|
||||||
|
VERSION ${GGML_VERSION}
|
||||||
|
SOVERSION ${GGML_VERSION_MAJOR}
|
||||||
|
)
|
||||||
|
|
||||||
if(NOT GGML_AVAILABLE_BACKENDS)
|
if(NOT GGML_AVAILABLE_BACKENDS)
|
||||||
set(GGML_AVAILABLE_BACKENDS "${backend}"
|
set(GGML_AVAILABLE_BACKENDS "${backend}"
|
||||||
CACHE INTERNAL "List of backends for cmake package")
|
CACHE INTERNAL "List of backends for cmake package")
|
||||||
|
|||||||
@@ -132,6 +132,11 @@ add_library(llama
|
|||||||
models/graph-context-mamba.cpp
|
models/graph-context-mamba.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(llama PROPERTIES
|
||||||
|
VERSION ${LLAMA_INSTALL_VERSION}
|
||||||
|
SOVERSION 0
|
||||||
|
)
|
||||||
|
|
||||||
target_include_directories(llama PRIVATE .)
|
target_include_directories(llama PRIVATE .)
|
||||||
target_include_directories(llama PUBLIC ../include)
|
target_include_directories(llama PUBLIC ../include)
|
||||||
target_compile_features (llama PRIVATE cxx_std_17) # don't bump
|
target_compile_features (llama PRIVATE cxx_std_17) # don't bump
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ add_library(mtmd
|
|||||||
mtmd-helper.h
|
mtmd-helper.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(mtmd PROPERTIES
|
||||||
|
VERSION ${LLAMA_INSTALL_VERSION}
|
||||||
|
SOVERSION 0
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries (mtmd PUBLIC ggml llama)
|
target_link_libraries (mtmd PUBLIC ggml llama)
|
||||||
target_link_libraries (mtmd PRIVATE Threads::Threads)
|
target_link_libraries (mtmd PRIVATE Threads::Threads)
|
||||||
target_include_directories(mtmd PUBLIC .)
|
target_include_directories(mtmd PUBLIC .)
|
||||||
|
|||||||
Reference in New Issue
Block a user