mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 02:44:36 +00:00
5cf5e7d490
* `build`: generate hex dumps of server assets on the fly * build: workaround lack of -n on gnu xxd * build: don't use xxd in cmake * build: don't call xxd from build.zig * build: more idiomatic hexing * build: don't use xxd in Makefile (od hackery instead) * build: avoid exceeding max cmd line limit in makefile hex dump * build: hex dump assets at cmake build time (not config time)
41 lines
1.4 KiB
CMake
41 lines
1.4 KiB
CMake
set(TARGET server)
|
|
option(LLAMA_SERVER_VERBOSE "Build verbose logging option for Server" ON)
|
|
option(LLAMA_SERVER_SSL "Build SSL support for the server" OFF)
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|
set(TARGET_SRCS
|
|
server.cpp
|
|
utils.hpp
|
|
httplib.h
|
|
)
|
|
set(PUBLIC_ASSETS
|
|
index.html
|
|
index.js
|
|
completion.js
|
|
json-schema-to-grammar.mjs
|
|
)
|
|
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"
|
|
)
|
|
endforeach()
|
|
add_executable(${TARGET} ${TARGET_SRCS})
|
|
install(TARGETS ${TARGET} RUNTIME)
|
|
target_compile_definitions(${TARGET} PRIVATE
|
|
SERVER_VERBOSE=$<BOOL:${LLAMA_SERVER_VERBOSE}>
|
|
)
|
|
target_link_libraries(${TARGET} PRIVATE common ${CMAKE_THREAD_LIBS_INIT})
|
|
if (LLAMA_SERVER_SSL)
|
|
find_package(OpenSSL REQUIRED)
|
|
target_link_libraries(${TARGET} PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
|
target_compile_definitions(${TARGET} PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
endif()
|
|
if (WIN32)
|
|
TARGET_LINK_LIBRARIES(${TARGET} PRIVATE ws2_32)
|
|
endif()
|
|
target_compile_features(${TARGET} PRIVATE cxx_std_11)
|