File tree Expand file tree Collapse file tree 2 files changed +28
-10
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +28
-10
lines changed
Original file line number Diff line number Diff line change 1
- set (CMAKE_SYSTEM_PROCESSOR "arm64" )
2
-
3
1
cmake_minimum_required (VERSION 3.4...3.22 )
4
2
5
3
project (llama_cpp )
6
4
7
- set (BUILD_SHARED_LIBS "On" )
8
- add_subdirectory (vendor/llama.cpp )
9
- install (
10
- TARGETS llama
11
- LIBRARY DESTINATION llama_cpp
12
- RUNTIME DESTINATION llama_cpp
13
- )
5
+ option (FORCE_CMAKE "Force CMake build of Python bindings" OFF )
6
+
7
+ set (FORCE_CMAKE $ENV{FORCE_CMAKE} )
8
+
9
+ if (UNIX AND NOT FORCE_CMAKE AND NOT APPLE )
10
+ add_custom_command (
11
+ OUTPUT ${CMAKE_CURRENT_SOURCE_DIR} /vendor/llama.cpp/libllama.so
12
+ COMMAND make libllama.so
13
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /vendor/llama.cpp
14
+ )
15
+ add_custom_target (
16
+ run ALL
17
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /vendor/llama.cpp/libllama.so
18
+ )
19
+ install (
20
+ FILES ${CMAKE_CURRENT_SOURCE_DIR} /vendor/llama.cpp/libllama.so
21
+ DESTINATION llama_cpp
22
+ )
23
+ else ()
24
+ set (BUILD_SHARED_LIBS "On" )
25
+ add_subdirectory (vendor/llama.cpp )
26
+ install (
27
+ TARGETS llama
28
+ LIBRARY DESTINATION llama_cpp
29
+ RUNTIME DESTINATION llama_cpp
30
+ )
31
+ endif (UNIX AND NOT FORCE_CMAKE AND NOT APPLE )
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def _load_shared_library(lib_base_name):
22
22
if sys .platform .startswith ("linux" ):
23
23
lib_ext = ".so"
24
24
elif sys .platform == "darwin" :
25
- lib_ext = ".so "
25
+ lib_ext = ".dylib "
26
26
elif sys .platform == "win32" :
27
27
lib_ext = ".dll"
28
28
else :
You can’t perform that action at this time.
0 commit comments