Skip to content

Commit db0a6ed

Browse files
committed
add skeleton for library
1 parent 3282f56 commit db0a6ed

File tree

6 files changed

+49
-1
lines changed

6 files changed

+49
-1
lines changed

tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ else()
2121
add_subdirectory(main)
2222
add_subdirectory(perplexity)
2323
add_subdirectory(quantize)
24+
add_subdirectory(server-core)
2425
if (LLAMA_BUILD_SERVER)
2526
add_subdirectory(server)
2627
endif()

tools/server-core/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# serve
2+
3+
set(TARGET server-core)
4+
5+
add_library(${TARGET}
6+
server-core.cpp
7+
server-utils.hpp
8+
)
9+
10+
target_include_directories(${TARGET} PUBLIC .)
11+
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
12+
13+
target_link_libraries(${TARGET} PRIVATE common mtmd)
14+
15+
target_compile_features(${TARGET} PRIVATE cxx_std_17)
16+
17+
if (BUILD_SHARED_LIBS)
18+
set_target_properties (${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
19+
target_compile_definitions(${TARGET} PRIVATE LLAMA_BUILD)
20+
target_compile_definitions(${TARGET} PUBLIC LLAMA_SHARED)
21+
endif()
22+
23+
set(serve_PUBLIC_HEADERS
24+
${CMAKE_CURRENT_SOURCE_DIR}/server-core.h
25+
${CMAKE_CURRENT_SOURCE_DIR}/server-core.hpp
26+
${CMAKE_CURRENT_SOURCE_DIR}/server-utils.hpp
27+
)
28+
29+
set_target_properties(${TARGET}
30+
PROPERTIES
31+
PUBLIC_HEADER "${serve_PUBLIC_HEADERS}")
32+
33+
install(TARGETS ${TARGET} LIBRARY PUBLIC_HEADER)
34+
35+
if (TARGET BUILD_INFO)
36+
add_dependencies(${TARGET} BUILD_INFO)
37+
endif()

tools/server-core/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# LLaMA.cpp Server core
2+
3+
Core of abstract server API for **llama.cpp**.

tools/server-core/server-core.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "server-core.h"
2+
3+
// placeholder, some implementation can be moved here

tools/server-core/server-core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
// placeholder, extern API to appear here

tools/server/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ add_executable(${TARGET} ${TARGET_SRCS})
3434
install(TARGETS ${TARGET} RUNTIME)
3535

3636
target_include_directories(${TARGET} PRIVATE ../llava)
37+
target_include_directories(${TARGET} PRIVATE ../server-core)
3738
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
38-
target_link_libraries(${TARGET} PRIVATE common mtmd ${CMAKE_THREAD_LIBS_INIT})
39+
target_link_libraries(${TARGET} PRIVATE server-core common mtmd ${CMAKE_THREAD_LIBS_INIT})
3940

4041
if (LLAMA_SERVER_SSL)
4142
find_package(OpenSSL REQUIRED)

0 commit comments

Comments
 (0)