Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ $ echo "source ~/.llama-completion.bash" >> ~/.bashrc
- [stb-image](https://github.com/nothings/stb) - Single-header image format decoder, used by multimodal subsystem - Public domain
- [nlohmann/json](https://github.com/nlohmann/json) - Single-header JSON library, used by various tools/examples - MIT License
- [minja](https://github.com/google/minja) - Minimal Jinja parser in C++, used by various tools/examples - MIT License
- [linenoise.cpp](./tools/run/linenoise.cpp/linenoise.cpp) - C++ library that provides readline-like line editing capabilities, used by `llama-run` - BSD 2-Clause License
- [readline.cpp](https://github.com/ericcurtin/readline.cpp) - C++ library that provides readline-like line editing capabilities, used by `llama-run` - MIT License
- [curl](https://curl.se/) - Client-side URL transfer library, used by various tools/examples - [CURL License](https://curl.se/docs/copyright.html)
- [miniaudio.h](https://github.com/mackron/miniaudio) - Single-header audio format decoder, used by multimodal subsystem - Public domain
- [subprocess.h](https://github.com/sheredom/subprocess.h) - Single-header process launching solution for C and C++ - Public domain
4 changes: 4 additions & 0 deletions scripts/sync_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.28.0/httplib.h": "vendor/cpp-httplib/httplib.h",

"https://raw.githubusercontent.com/sheredom/subprocess.h/b49c56e9fe214488493021017bf3954b91c7c1f5/subprocess.h": "vendor/sheredom/subprocess.h",

# readline.cpp: multi-file library for interactive line editing
# sync manually - no upstream repository yet
# located in vendor/readline.cpp/
}

for url, filename in vendor.items():
Expand Down
43 changes: 41 additions & 2 deletions tools/run/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
set(TARGET llama-run)
add_executable(${TARGET} run.cpp linenoise.cpp/linenoise.cpp)

if (MINGW)
# fix: https://github.com/ggml-org/llama.cpp/actions/runs/9651004652/job/26617901362?pr=8006
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
endif()

# Include server source files (except server.cpp which has its own main())
set(SERVER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../server)
set(READLINE_DIR ${PROJECT_SOURCE_DIR}/vendor/readline.cpp)
set(TARGET_SRCS
run.cpp
${SERVER_DIR}/server-context.cpp
${SERVER_DIR}/server-context.h
${SERVER_DIR}/server-task.cpp
${SERVER_DIR}/server-task.h
${SERVER_DIR}/server-queue.cpp
${SERVER_DIR}/server-queue.h
${SERVER_DIR}/server-common.cpp
${SERVER_DIR}/server-common.h
${CMAKE_CURRENT_SOURCE_DIR}/run-chat.cpp
${CMAKE_CURRENT_SOURCE_DIR}/run-chat.h
${READLINE_DIR}/src/readline.cpp
${READLINE_DIR}/src/buffer.cpp
${READLINE_DIR}/src/history.cpp
${READLINE_DIR}/src/terminal.cpp
)

add_executable(${TARGET} ${TARGET_SRCS})

# TODO: avoid copying this code block from common/CMakeLists.txt
set(LLAMA_RUN_EXTRA_LIBS "")
Expand All @@ -19,5 +46,17 @@ if (CMAKE_SYSTEM_NAME MATCHES "AIX")
target_link_libraries(${TARGET} PRIVATE -lbsd)
endif()

target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT} ${LLAMA_RUN_EXTRA_LIBS})
# Include directories for server headers and readline
target_include_directories(${TARGET} PRIVATE ${SERVER_DIR})
target_include_directories(${TARGET} PRIVATE ${SERVER_DIR}/../mtmd)
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(${TARGET} PRIVATE ${READLINE_DIR}/include)
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries(${TARGET} PRIVATE common mtmd llama ${CMAKE_THREAD_LIBS_INIT} ${LLAMA_RUN_EXTRA_LIBS})

if (WIN32)
target_link_libraries(${TARGET} PRIVATE ws2_32)
endif()

target_compile_features(${TARGET} PRIVATE cxx_std_17)
Loading
Loading