Build shared library with make on unix platforms
This commit is contained in:
parent
a3f713039f
commit
e611cfc56d
1 changed files with 23 additions and 9 deletions
|
@ -2,12 +2,26 @@ cmake_minimum_required(VERSION 3.4...3.22)
|
|||
|
||||
project(llama_cpp)
|
||||
|
||||
set(BUILD_SHARED_LIBS "On")
|
||||
|
||||
add_subdirectory(vendor/llama.cpp)
|
||||
|
||||
install(
|
||||
TARGETS llama
|
||||
LIBRARY DESTINATION llama_cpp
|
||||
RUNTIME DESTINATION llama_cpp
|
||||
)
|
||||
if (UNIX)
|
||||
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
|
||||
DESTINATION llama_cpp
|
||||
)
|
||||
else()
|
||||
set(BUILD_SHARED_LIBS "On")
|
||||
add_subdirectory(vendor/llama.cpp)
|
||||
install(
|
||||
TARGETS llama
|
||||
LIBRARY DESTINATION llama_cpp
|
||||
RUNTIME DESTINATION llama_cpp
|
||||
)
|
||||
endif(UNIX)
|
||||
|
|
Loading…
Reference in a new issue