mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-27 06:39:25 +01:00
91c36c269b
* hide buttons in dropdown menu * use npm as deps manager and vite as bundler * fix build * fix build (2) * fix responsive on mobile * fix more problems on mobile * sync build * (test) add CI step for verifying build * fix ci * force rebuild .hpp files * cmake: clean up generated files pre build
58 lines
1.7 KiB
CMake
58 lines
1.7 KiB
CMake
set(TARGET llama-server)
|
|
|
|
option(LLAMA_SERVER_SSL "Build SSL support for the server" OFF)
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
if (MINGW)
|
|
# fix: https://github.com/ggerganov/llama.cpp/actions/runs/9651004652/job/26617901362?pr=8006
|
|
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
|
|
endif()
|
|
|
|
set(TARGET_SRCS
|
|
server.cpp
|
|
utils.hpp
|
|
httplib.h
|
|
)
|
|
set(PUBLIC_ASSETS
|
|
index.html
|
|
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)
|
|
|
|
# clean up generated files in pre-build step
|
|
foreach(asset ${PUBLIC_ASSETS})
|
|
set(output "${CMAKE_CURRENT_BINARY_DIR}/${asset}.hpp")
|
|
add_custom_command(TARGET ${TARGET} PRE_BUILD
|
|
COMMAND "${CMAKE_COMMAND}" -E remove -f "${output}"
|
|
)
|
|
endforeach()
|
|
|
|
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_17)
|