Skip to content

Commit c0bd267

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 ac76d36 commit c0bd267

File tree

17 files changed

+93
-0
lines changed

17 files changed

+93
-0
lines changed

ggml/src/CMakeLists.txt

Lines changed: 10 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")

ggml/src/ggml-blas/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ if (BLAS_FOUND)
1515
ggml-blas.cpp
1616
)
1717

18+
set_target_properties(ggml-blas PROPERTIES
19+
VERSION ${GGML_VERSION}
20+
SOVERSION ${GGML_VERSION_MAJOR}
21+
)
22+
1823
if (${GGML_BLAS_VENDOR} MATCHES "Apple")
1924
add_compile_definitions(ACCELERATE_NEW_LAPACK)
2025
add_compile_definitions(ACCELERATE_LAPACK_ILP64)

ggml/src/ggml-cann/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ if (CANN_INSTALL_DIR)
6969
file(GLOB GGML_SOURCES_CANN "*.cpp")
7070

7171
ggml_add_backend_library(ggml-cann ${GGML_SOURCES_CANN})
72+
73+
set_target_properties(ggml-cann PROPERTIES
74+
VERSION ${GGML_VERSION}
75+
SOVERSION ${GGML_VERSION_MAJOR}
76+
)
77+
7278
target_link_libraries(ggml-cann PRIVATE ${CANN_LIBRARIES})
7379
target_include_directories(ggml-cann PRIVATE ${CANN_INCLUDE_DIRS})
7480
target_link_directories(ggml-cann PRIVATE ${CANN_INSTALL_DIR}/lib64)

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
2121

2222
ggml_add_backend_library(${GGML_CPU_NAME})
2323

24+
set_target_properties(${GGML_CPU_NAME} PROPERTIES
25+
VERSION ${GGML_VERSION}
26+
SOVERSION ${GGML_VERSION_MAJOR}
27+
)
28+
2429
list (APPEND GGML_CPU_SOURCES
2530
ggml-cpu/ggml-cpu.c
2631
ggml-cpu/ggml-cpu.cpp

ggml/src/ggml-cuda/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ if (CUDAToolkit_FOUND)
7171
${GGML_SOURCES_CUDA}
7272
)
7373

74+
set_target_properties(ggml-cuda PROPERTIES
75+
VERSION ${GGML_VERSION}
76+
SOVERSION ${GGML_VERSION_MAJOR}
77+
)
78+
7479
add_compile_definitions(GGML_CUDA_PEER_MAX_BATCH_SIZE=${GGML_CUDA_PEER_MAX_BATCH_SIZE})
7580

7681
if (GGML_CUDA_GRAPHS)

ggml/src/ggml-hexagon/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ set(TARGET_NAME ggml-hexagon)
3131
ggml_add_backend_library(${TARGET_NAME}
3232
ggml-hexagon.cpp htp-utils.c htp-utils.h ../../include/ggml-hexagon.h)
3333

34+
set_target_properties(${TARGET_NAME} PROPERTIES
35+
VERSION ${GGML_VERSION}
36+
SOVERSION ${GGML_VERSION_MAJOR}
37+
)
38+
3439
target_link_libraries(${TARGET_NAME} PRIVATE htp_iface)
3540
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/htp ${CMAKE_CURRENT_BINARY_DIR})
3641

ggml/src/ggml-hip/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ ggml_add_backend_library(ggml-hip
8181
${GGML_SOURCES_ROCM}
8282
)
8383

84+
set_target_properties(ggml-hip PROPERTIES
85+
VERSION ${GGML_VERSION}
86+
SOVERSION ${GGML_VERSION_MAJOR}
87+
)
88+
8489
# TODO: do not use CUDA definitions for HIP
8590
if (NOT GGML_BACKEND_DL)
8691
target_compile_definitions(ggml PUBLIC GGML_USE_CUDA)

ggml/src/ggml-metal/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ ggml_add_backend_library(ggml-metal
1313
ggml-metal-ops.cpp
1414
)
1515

16+
set_target_properties(ggml-metal PROPERTIES
17+
VERSION ${GGML_VERSION}
18+
SOVERSION ${GGML_VERSION_MAJOR}
19+
)
20+
1621
target_link_libraries(ggml-metal PRIVATE
1722
${FOUNDATION_LIBRARY}
1823
${METAL_FRAMEWORK}

ggml/src/ggml-musa/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ if (MUSAToolkit_FOUND)
7070
${GGML_SOURCES_MUSA}
7171
)
7272

73+
set_target_properties(ggml-musa PROPERTIES
74+
VERSION ${GGML_VERSION}
75+
SOVERSION ${GGML_VERSION_MAJOR}
76+
)
77+
7378
# TODO: do not use CUDA definitions for MUSA
7479
if (NOT GGML_BACKEND_DL)
7580
target_compile_definitions(ggml PUBLIC GGML_USE_CUDA)

ggml/src/ggml-opencl/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ set(TARGET_NAME ggml-opencl)
66
ggml_add_backend_library(${TARGET_NAME}
77
ggml-opencl.cpp
88
../../include/ggml-opencl.h)
9+
10+
set_target_properties(${TARGET_NAME} PROPERTIES
11+
VERSION ${GGML_VERSION}
12+
SOVERSION ${GGML_VERSION_MAJOR}
13+
)
14+
915
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCL_LIBRARIES})
1016
target_include_directories(${TARGET_NAME} PRIVATE ${OpenCL_INCLUDE_DIRS})
1117

0 commit comments

Comments
 (0)