Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c546c94

Browse files
committed
misc: Install shared libraries to lib subdirectory
1 parent bf5e0bb commit c546c94

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ option(LLAVA_BUILD "Build llava shared library and install alongside python pack
88
if(SKBUILD_STATE STREQUAL "editable")
99
# Install into the source directory
1010
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
11-
set(LLAMA_CPP_PYTHON_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp)
11+
set(LLAMA_CPP_PYTHON_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib)
1212
else()
13-
set(LLAMA_CPP_PYTHON_INSTALL_DIR ${SKBUILD_PLATLIB_DIR}/llama_cpp)
13+
set(LLAMA_CPP_PYTHON_INSTALL_DIR ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib)
1414
endif()
1515

16+
message(STATUS "LLAMA_CPP_PYTHON_INSTALL_DIR: ${LLAMA_CPP_PYTHON_INSTALL_DIR}")
17+
1618
if (LLAMA_BUILD)
1719
set(BUILD_SHARED_LIBS "On")
1820

llama_cpp/llama_cpp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Load the library
2424
def _load_shared_library(lib_base_name: str):
2525
# Construct the paths to the possible shared library names
26-
_base_path = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
26+
_base_path = pathlib.Path(os.path.abspath(os.path.dirname(__file__))) / "lib"
2727
# Searching for the library in the current directory under the name "libllama" (default name
2828
# for llamacpp) and "llama" (default name for this repo)
2929
_lib_paths: List[pathlib.Path] = []

llama_cpp/llava_cpp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# Load the library
3636
def _load_shared_library(lib_base_name: str):
3737
# Construct the paths to the possible shared library names
38-
_base_path = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
38+
_base_path = pathlib.Path(os.path.abspath(os.path.dirname(__file__))) / "lib"
3939
# Searching for the library in the current directory under the name "libllama" (default name
4040
# for llamacpp) and "llama" (default name for this repo)
4141
_lib_paths: List[pathlib.Path] = []

0 commit comments

Comments
 (0)