2023-03-23 17:54:14 +00:00
|
|
|
cmake_minimum_required(VERSION 3.4...3.22)
|
|
|
|
|
|
|
|
project(llama_cpp)
|
|
|
|
|
2023-04-25 05:36:37 +00:00
|
|
|
option(FORCE_CMAKE "Force CMake build of Python bindings" OFF)
|
|
|
|
|
|
|
|
set(FORCE_CMAKE $ENV{FORCE_CMAKE})
|
|
|
|
|
|
|
|
if (UNIX AND NOT FORCE_CMAKE)
|
2023-04-08 06:39:17 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
|
|
|
|
COMMAND make libllama.so
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp
|
|
|
|
)
|
|
|
|
add_custom_target(
|
|
|
|
run ALL
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
|
|
|
|
)
|
|
|
|
install(
|
|
|
|
FILES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
|
2023-06-10 03:23:16 +00:00
|
|
|
DESTINATION llama_cpp
|
2023-04-08 06:39:17 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(BUILD_SHARED_LIBS "On")
|
|
|
|
add_subdirectory(vendor/llama.cpp)
|
|
|
|
install(
|
|
|
|
TARGETS llama
|
2023-06-10 03:23:16 +00:00
|
|
|
LIBRARY DESTINATION llama_cpp
|
|
|
|
RUNTIME DESTINATION llama_cpp
|
|
|
|
ARCHIVE DESTINATION llama_cpp
|
|
|
|
FRAMEWORK DESTINATION llama_cpp
|
2023-04-08 06:39:17 +00:00
|
|
|
)
|
2023-05-16 13:07:14 +00:00
|
|
|
endif()
|