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

Skip to content

[pull] main from abetlen:main #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 50 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ if (LLAMA_BUILD)
set(GGML_METAL_EMBED_LIBRARY "ON" CACHE BOOL "ggml: embed metal library" FORCE)
endif()


add_subdirectory(vendor/llama.cpp)

if (WIN32)
if (TARGET llama)
set_target_properties(llama PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
endif()

llama_cpp_python_install_target(llama)
llama_cpp_python_install_target(ggml)

Expand Down Expand Up @@ -135,46 +143,46 @@ if (LLAMA_BUILD)
)
endif()

if (LLAVA_BUILD)
if (LLAMA_CUBLAS OR LLAMA_CUDA)
add_compile_definitions(GGML_USE_CUBLAS)
add_compile_definitions(GGML_USE_CUDA)
endif()

if (LLAMA_METAL)
add_compile_definitions(GGML_USE_METAL)
endif()

# Building llava
add_subdirectory(vendor/llama.cpp/tools/mtmd)
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")

if (WIN32)
set_target_properties(llava_shared PROPERTIES CUDA_ARCHITECTURES OFF)
endif()
llama_cpp_python_install_target(llava_shared)
if (WIN32)
install(
FILES $<TARGET_RUNTIME_DLLS:llava_shared>
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib
)
install(
FILES $<TARGET_RUNTIME_DLLS:llava_shared>
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib
)
endif()

# Fix for llava build: Add include directory for llama.h
# Move these commands after the add_subdirectory call
target_include_directories(llava PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
target_include_directories(llava PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/ggml/include)

if (BUILD_SHARED_LIBS)
target_include_directories(llava_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
target_include_directories(llava_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/ggml/include)
endif()

target_include_directories(llama-llava-cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
target_include_directories(llama-minicpmv-cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
endif()
# if (LLAVA_BUILD)
# if (LLAMA_CUBLAS OR LLAMA_CUDA)
# add_compile_definitions(GGML_USE_CUBLAS)
# add_compile_definitions(GGML_USE_CUDA)
# endif()
#
# if (LLAMA_METAL)
# add_compile_definitions(GGML_USE_METAL)
# endif()
#
# # Building llava
# add_subdirectory(vendor/llama.cpp/tools/mtmd)
# set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
#
# if (WIN32)
# set_target_properties(llava_shared PROPERTIES CUDA_ARCHITECTURES OFF)
# endif()
# llama_cpp_python_install_target(llava_shared)
# if (WIN32)
# install(
# FILES $<TARGET_RUNTIME_DLLS:llava_shared>
# DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib
# )
# install(
# FILES $<TARGET_RUNTIME_DLLS:llava_shared>
# DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib
# )
# endif()
#
# # Fix for llava build: Add include directory for llama.h
# # Move these commands after the add_subdirectory call
# target_include_directories(llava PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
# target_include_directories(llava PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/ggml/include)
#
# if (BUILD_SHARED_LIBS)
# target_include_directories(llava_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
# target_include_directories(llava_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/ggml/include)
# endif()
#
# target_include_directories(llama-llava-cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
# target_include_directories(llama-minicpmv-cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/include)
# endif()
endif()
Loading