8000 Build shared library with make on unix platforms · coderonion/llama-cpp-python@e611cfc · GitHub
[go: up one dir, main page]

Skip to content

Commit e611cfc

Browse files
committed
Build shared library with make on unix platforms
1 parent a3f7130 commit e611cfc

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

CMakeLists.txt

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@ cmake_minimum_required(VERSION 3.4...3.22)
22

33
project(llama_cpp)
44

5-
set(BUILD_SHARED_LIBS "On")
6-
7-
add_subdirectory(vendor/llama.cpp)
8-
9-
install(
10-
TARGETS llama
11-
LIBRARY DESTINATION llama_cpp
12-
RUNTIME DESTINATION llama_cpp
13-
)
5+
if (UNIX)
6+
add_custom_command(
7+
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
8+
COMMAND make libllama.so
9+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp
10+
)
11+
add_custom_target(
12+
run ALL
13+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
14+
)
15+
install(
16+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
17+
DESTINATION llama_cpp
18+
)
19+
else()
20+
set(BUILD_SHARED_LIBS "On")
21+
add_subdirectory(vendor/llama.cpp)
22+
install(
23+
TARGETS llama
24+
LIBRARY DESTINATION llama_cpp
25+
RUNTIME DESTINATION llama_cpp
26+
)
27+
endif(UNIX)

0 commit comments

Comments
 (0)
0