2023-07-06 00:45:11 +00:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
|
|
project(binding)
|
|
|
|
|
2023-07-03 19:22:44 +00:00
|
|
|
include(FetchContent)
|
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
llama_cpp
|
|
|
|
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
|
2023-07-05 20:28:18 +00:00
|
|
|
GIT_TAG 55dbb91
|
2023-07-03 19:22:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(llama_cpp)
|
|
|
|
|
2023-07-03 20:32:48 +00:00
|
|
|
add_library(binding ${CMAKE_CURRENT_SOURCE_DIR}/binding/binding.cpp ${llama_cpp_SOURCE_DIR}/examples/common.cpp)
|
2023-07-03 19:22:44 +00:00
|
|
|
target_include_directories(binding PRIVATE ${llama_cpp_SOURCE_DIR}/examples)
|
|
|
|
target_link_libraries(binding llama ggml_static)
|
2023-07-03 20:32:48 +00:00
|
|
|
|
2023-07-06 00:45:11 +00:00
|
|
|
if (LLAMA_METAL)
|
|
|
|
configure_file(${llama_cpp_SOURCE_DIR}/ggml-metal.metal ${CMAKE_CURRENT_BINARY_DIR}/../../ggml-metal.metal COPYONLY)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_target(copy_libllama ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:llama> ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_custom_target(copy_libggml_static ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:ggml_static> ${CMAKE_CURRENT_BINARY_DIR})
|