* wip * wip * fix logging, add display info * handle commands * add args * wip * move old cli to llama-completion * rm deprecation notice * move server to a shared library * move ci to llama-completion * add loading animation * add --show-timings arg * add /read command, improve LOG_ERR * add args for speculative decoding, enable show timings by default * add arg --image and --audio * fix windows build * support reasoning_content * fix llama2c workflow * color default is auto * fix merge conflicts * properly fix color problem Co-authored-by: bandoti <bandoti@users.noreply.github.com> * better loading spinner * make sure to clean color on force-exit * also clear input files on "/clear" * simplify common_log_flush * add warning in mtmd-cli * implement console writter * fix data race * add attribute * fix llama-completion and mtmd-cli * add some notes about console::log * fix compilation --------- Co-authored-by: bandoti <bandoti@users.noreply.github.com>
70 lines
1.9 KiB
CMake
70 lines
1.9 KiB
CMake
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
# server-context containing the core server logic, used by llama-server and CLI
|
|
|
|
set(TARGET server-context)
|
|
|
|
add_library(${TARGET} STATIC
|
|
server-task.cpp
|
|
server-task.h
|
|
server-queue.cpp
|
|
server-queue.h
|
|
server-common.cpp
|
|
server-common.h
|
|
server-context.cpp
|
|
server-context.h
|
|
)
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
endif()
|
|
|
|
target_include_directories(${TARGET} PRIVATE ../mtmd)
|
|
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
|
|
target_link_libraries(${TARGET} PUBLIC common mtmd ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
# llama-server executable
|
|
|
|
set(TARGET llama-server)
|
|
|
|
if (NOT LLAMA_HTTPLIB)
|
|
message(FATAL_ERROR "LLAMA_HTTPLIB is OFF, cannot build llama-server. Hint: to skip building server, set -DLLAMA_BUILD_SERVER=OFF")
|
|
endif()
|
|
|
|
set(TARGET_SRCS
|
|
server.cpp
|
|
server-http.cpp
|
|
server-http.h
|
|
server-models.cpp
|
|
server-models.h
|
|
)
|
|
set(PUBLIC_ASSETS
|
|
index.html.gz
|
|
loading.html
|
|
)
|
|
|
|
foreach(asset ${PUBLIC_ASSETS})
|
|
set(input "${CMAKE_CURRENT_SOURCE_DIR}/public/${asset}")
|
|
set(output "${CMAKE_CURRENT_BINARY_DIR}/${asset}.hpp")
|
|
list(APPEND TARGET_SRCS ${output})
|
|
add_custom_command(
|
|
DEPENDS "${input}"
|
|
OUTPUT "${output}"
|
|
COMMAND "${CMAKE_COMMAND}" "-DINPUT=${input}" "-DOUTPUT=${output}" -P "${PROJECT_SOURCE_DIR}/scripts/xxd.cmake"
|
|
)
|
|
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
|
|
endforeach()
|
|
|
|
add_executable(${TARGET} ${TARGET_SRCS})
|
|
install(TARGETS ${TARGET} RUNTIME)
|
|
|
|
target_include_directories(${TARGET} PRIVATE ../mtmd)
|
|
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
|
|
target_link_libraries(${TARGET} PRIVATE server-context PUBLIC common cpp-httplib ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
if (WIN32)
|
|
TARGET_LINK_LIBRARIES(${TARGET} PRIVATE ws2_32)
|
|
endif()
|
|
|
|
target_compile_features(${TARGET} PRIVATE cxx_std_17)
|