setup windows linking for llguidance; thanks @phil-scott-78
This commit is contained in:
parent
3ec9fd4b77
commit
7d8c170cf5
1 changed files with 20 additions and 3 deletions
|
@ -96,6 +96,22 @@ if (LLAMA_LLGUIDANCE)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(LLGUIDANCE_SRC ${CMAKE_BINARY_DIR}/llguidance/source)
|
set(LLGUIDANCE_SRC ${CMAKE_BINARY_DIR}/llguidance/source)
|
||||||
set(LLGUIDANCE_PATH ${LLGUIDANCE_SRC}/target/release)
|
set(LLGUIDANCE_PATH ${LLGUIDANCE_SRC}/target/release)
|
||||||
|
|
||||||
|
# Set the correct library file extension based on platform
|
||||||
|
if (WIN32)
|
||||||
|
set(LLGUIDANCE_LIB_NAME "llguidance.lib")
|
||||||
|
# Add Windows-specific libraries
|
||||||
|
set(LLGUIDANCE_PLATFORM_LIBS
|
||||||
|
ws2_32 # Windows Sockets API
|
||||||
|
userenv # For GetUserProfileDirectoryW
|
||||||
|
ntdll # For NT functions
|
||||||
|
bcrypt # For BCryptGenRandom
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(LLGUIDANCE_LIB_NAME "libllguidance.a")
|
||||||
|
set(LLGUIDANCE_PLATFORM_LIBS "")
|
||||||
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(llguidance_ext
|
ExternalProject_Add(llguidance_ext
|
||||||
GIT_REPOSITORY https://github.com/guidance-ai/llguidance
|
GIT_REPOSITORY https://github.com/guidance-ai/llguidance
|
||||||
# v0.6.12:
|
# v0.6.12:
|
||||||
|
@ -106,17 +122,18 @@ if (LLAMA_LLGUIDANCE)
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND cargo build --release
|
BUILD_COMMAND cargo build --release
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS ${LLGUIDANCE_PATH}/libllguidance.a ${LLGUIDANCE_PATH}/llguidance.h
|
BUILD_BYPRODUCTS ${LLGUIDANCE_PATH}/${LLGUIDANCE_LIB_NAME} ${LLGUIDANCE_PATH}/llguidance.h
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
)
|
)
|
||||||
target_compile_definitions(${TARGET} PUBLIC LLAMA_USE_LLGUIDANCE)
|
target_compile_definitions(${TARGET} PUBLIC LLAMA_USE_LLGUIDANCE)
|
||||||
|
|
||||||
add_library(llguidance STATIC IMPORTED)
|
add_library(llguidance STATIC IMPORTED)
|
||||||
set_target_properties(llguidance PROPERTIES IMPORTED_LOCATION ${LLGUIDANCE_PATH}/libllguidance.a)
|
set_target_properties(llguidance PROPERTIES IMPORTED_LOCATION ${LLGUIDANCE_PATH}/${LLGUIDANCE_LIB_NAME})
|
||||||
add_dependencies(llguidance llguidance_ext)
|
add_dependencies(llguidance llguidance_ext)
|
||||||
|
|
||||||
target_include_directories(${TARGET} PRIVATE ${LLGUIDANCE_PATH})
|
target_include_directories(${TARGET} PRIVATE ${LLGUIDANCE_PATH})
|
||||||
set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance)
|
# Add platform libraries to the main target
|
||||||
|
set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance ${LLGUIDANCE_PLATFORM_LIBS})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_include_directories(${TARGET} PUBLIC .)
|
target_include_directories(${TARGET} PUBLIC .)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue