Make building llava optional
This commit is contained in:
parent
74f1949206
commit
e3941d9c67
2 changed files with 28 additions and 25 deletions
|
@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.21)
|
||||||
project(llama_cpp)
|
project(llama_cpp)
|
||||||
|
|
||||||
option(LLAMA_BUILD "Build llama.cpp shared library and install alongside python package" ON)
|
option(LLAMA_BUILD "Build llama.cpp shared library and install alongside python package" ON)
|
||||||
|
option(LLAVA_BUILD "Build llava shared library and install alongside python package" ON)
|
||||||
|
|
||||||
if (LLAMA_BUILD)
|
if (LLAMA_BUILD)
|
||||||
set(BUILD_SHARED_LIBS "On")
|
set(BUILD_SHARED_LIBS "On")
|
||||||
|
@ -44,6 +45,7 @@ if (LLAMA_BUILD)
|
||||||
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (LLAVA_BUILD)
|
||||||
# Building llava
|
# Building llava
|
||||||
add_subdirectory(vendor/llama.cpp/examples/llava)
|
add_subdirectory(vendor/llama.cpp/examples/llava)
|
||||||
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
|
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
|
||||||
|
@ -68,4 +70,5 @@ if (LLAMA_BUILD)
|
||||||
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
||||||
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -48,8 +48,8 @@ def _load_shared_library(lib_base_name: str):
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unsupported platform")
|
raise RuntimeError("Unsupported platform")
|
||||||
|
|
||||||
if "LLAMA_CPP_LIB" in os.environ:
|
if "LLAVA_CPP_LIB" in os.environ:
|
||||||
lib_base_name = os.environ["LLAMA_CPP_LIB"]
|
lib_base_name = os.environ["LLAVA_CPP_LIB"]
|
||||||
_lib = pathlib.Path(lib_base_name)
|
_lib = pathlib.Path(lib_base_name)
|
||||||
_base_path = _lib.parent.resolve()
|
_base_path = _lib.parent.resolve()
|
||||||
_lib_paths = [_lib.resolve()]
|
_lib_paths = [_lib.resolve()]
|
||||||
|
|
Loading…
Reference in a new issue