|
|
@@ -214,6 +214,13 @@ add_library(ggml
|
|
|
ggml-backend-reg.cpp)
|
|
|
add_library(ggml::ggml ALIAS ggml)
|
|
|
|
|
|
+if (GGML_BACKEND_DIR)
|
|
|
+ if (NOT GGML_BACKEND_DL)
|
|
|
+ message(FATAL_ERROR "GGML_BACKEND_DIR requires GGML_BACKEND_DL")
|
|
|
+ endif()
|
|
|
+ target_compile_definitions(ggml PUBLIC GGML_BACKEND_DIR="${GGML_BACKEND_DIR}")
|
|
|
+endif()
|
|
|
+
|
|
|
target_link_libraries(ggml PUBLIC ggml-base)
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
@@ -227,7 +234,11 @@ function(ggml_add_backend_library backend)
|
|
|
set_target_properties(${backend} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
|
target_compile_definitions(${backend} PRIVATE GGML_BACKEND_DL)
|
|
|
add_dependencies(ggml ${backend})
|
|
|
- install(TARGETS ${backend} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
+ if (GGML_BACKEND_DIR)
|
|
|
+ install(TARGETS ${backend} LIBRARY DESTINATION ${GGML_BACKEND_DIR})
|
|
|
+ else()
|
|
|
+ install(TARGETS ${backend} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
+ endif()
|
|
|
else()
|
|
|
add_library(${backend} ${ARGN})
|
|
|
target_link_libraries(ggml PUBLIC ${backend})
|