mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-31 06:03:11 +01:00
Expand variables with GGML_ prefix
This commit is contained in:
parent
5b4c12e92e
commit
314f26cc8b
@ -269,8 +269,7 @@ endif()
|
|||||||
# Create CMake package
|
# Create CMake package
|
||||||
#
|
#
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
# * Generate version info based on git commit.
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
|
|
||||||
find_program(GIT_EXE NAMES git git.exe REQUIRED NO_CMAKE_FIND_ROOT_PATH)
|
find_program(GIT_EXE NAMES git git.exe REQUIRED NO_CMAKE_FIND_ROOT_PATH)
|
||||||
execute_process(COMMAND ${GIT_EXE} rev-list --count HEAD
|
execute_process(COMMAND ${GIT_EXE} rev-list --count HEAD
|
||||||
@ -290,8 +289,31 @@ execute_process(COMMAND ${GIT_EXE} rev-parse --short HEAD
|
|||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
set(GGML_INSTALL_VERSION 0.0.${GGML_BUILD_NUMBER})
|
# * Capture variables prefixed with GGML_.
|
||||||
|
|
||||||
|
set(variable_set_statements
|
||||||
|
"
|
||||||
|
####### Expanded from @GGML_VARIABLES_EXPANED@ by configure_package_config_file() #######
|
||||||
|
####### Any changes to this file will be overwritten by the next CMake run #######
|
||||||
|
|
||||||
|
")
|
||||||
|
|
||||||
|
get_cmake_property(all_variables VARIABLES)
|
||||||
|
foreach(variable_name IN LISTS all_variables)
|
||||||
|
if(variable_name MATCHES "^GGML_")
|
||||||
|
string(REPLACE ";" "\\;"
|
||||||
|
variable_value "${${variable_name}}")
|
||||||
|
|
||||||
|
set(variable_set_statements
|
||||||
|
"${variable_set_statements}set(${variable_name} \"${variable_value}\")\n")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(GGML_VARIABLES_EXPANDED ${variable_set_statements})
|
||||||
|
|
||||||
|
# * Create the CMake package and set install location.
|
||||||
|
|
||||||
|
set(GGML_INSTALL_VERSION 0.0.${GGML_BUILD_NUMBER})
|
||||||
set(GGML_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
|
set(GGML_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
|
||||||
set(GGML_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
|
set(GGML_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
|
||||||
set(GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")
|
set(GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")
|
||||||
|
@ -84,7 +84,7 @@ if (NOT GGML_SHARED_LIB)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(_ggml_all_targets "")
|
set(_ggml_all_targets "")
|
||||||
foreach(_ggml_backend @GGML_BACKENDS@)
|
foreach(_ggml_backend ${GGML_AVAILABLE_BACKENDS})
|
||||||
string(replace "-" "_" _ggml_backend_pfx "${_ggml_backend}")
|
string(replace "-" "_" _ggml_backend_pfx "${_ggml_backend}")
|
||||||
|
|
||||||
find_library(${_ggml_backend_pfx}_LIBRARY ${_ggml_backend}
|
find_library(${_ggml_backend_pfx}_LIBRARY ${_ggml_backend}
|
||||||
|
@ -250,6 +250,13 @@ function(ggml_add_backend_library backend)
|
|||||||
target_compile_definitions(${backend} PRIVATE GGML_BACKEND_BUILD)
|
target_compile_definitions(${backend} PRIVATE GGML_BACKEND_BUILD)
|
||||||
target_compile_definitions(${backend} PUBLIC GGML_BACKEND_SHARED)
|
target_compile_definitions(${backend} PUBLIC GGML_BACKEND_SHARED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT GGML_AVAILABLE_BACKENDS)
|
||||||
|
set(GGML_AVAILABLE_BACKENDS "${backend}" CACHE INTERNAL "List of backends for cmake package")
|
||||||
|
else()
|
||||||
|
set(GGML_AVAILABLE_BACKENDS "${GGML_AVAILABLE_BACKENDS};${backend}"
|
||||||
|
CACHE INTERNAL "List of backends for cmake package")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(ggml_add_backend backend)
|
function(ggml_add_backend backend)
|
||||||
|
Loading…
Reference in New Issue
Block a user