Skip to content

Commit 2719f80

Browse files
add version to all shared object files
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.
1 parent 299f5d7 commit 2719f80

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

ggml/src/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ add_library(ggml-base
211211
ggml-quants.h
212212
gguf.cpp)
213213

214+
set_target_properties(ggml-base PROPERTIES
215+
VERSION ${GGML_VERSION}
216+
SOVERSION ${GGML_VERSION_MAJOR}
217+
)
218+
214219
target_include_directories(ggml-base PRIVATE .)
215220
if (GGML_BACKEND_DL)
216221
target_compile_definitions(ggml-base PUBLIC GGML_BACKEND_DL)
@@ -220,6 +225,11 @@ add_library(ggml
220225
ggml-backend-reg.cpp)
221226
add_library(ggml::ggml ALIAS ggml)
222227

228+
set_target_properties(ggml PROPERTIES
229+
VERSION ${GGML_VERSION}
230+
SOVERSION ${GGML_VERSION_MAJOR}
231+
)
232+
223233
if (GGML_BACKEND_DIR)
224234
if (NOT GGML_BACKEND_DL)
225235
message(FATAL_ERROR "GGML_BACKEND_DIR requires GGML_BACKEND_DL")
@@ -259,6 +269,12 @@ function(ggml_add_backend_library backend)
259269
target_compile_definitions(${backend} PUBLIC GGML_BACKEND_SHARED)
260270
endif()
261271

272+
# Set versioning properties for all backend libraries
273+
set_target_properties(${backend} PROPERTIES
274+
VERSION ${GGML_VERSION}
275+
SOVERSION ${GGML_VERSION_MAJOR}
276+
)
277+
262278
if(NOT GGML_AVAILABLE_BACKENDS)
263279
set(GGML_AVAILABLE_BACKENDS "${backend}"
264280
CACHE INTERNAL "List of backends for cmake package")

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ add_library(llama
132132
models/graph-context-mamba.cpp
133133
)
134134

135+
set_target_properties(llama PROPERTIES
136+
VERSION ${LLAMA_INSTALL_VERSION}
137+
SOVERSION 0
138+
)
139+
135140
target_include_directories(llama PRIVATE .)
136141
target_include_directories(llama PUBLIC ../include)
137142
target_compile_features (llama PRIVATE cxx_std_17) # don't bump

tools/mtmd/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ add_library(mtmd
1313
mtmd-helper.h
1414
)
1515

16+
set_target_properties(mtmd PROPERTIES
17+
VERSION ${LLAMA_INSTALL_VERSION}
18+
SOVERSION 0
19+
)
20+
1621
target_link_libraries (mtmd PUBLIC ggml llama)
1722
target_link_libraries (mtmd PRIVATE Threads::Threads)
1823
target_include_directories(mtmd PUBLIC .)

0 commit comments

Comments
 (0)