From adeb1d5c5c2da7871171245a920ffd782794a7f4 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 21 May 2026 10:32:15 +0300 Subject: [PATCH 1/3] cmake : remove STATIC from impl libraries, allow BUILD_SHARED_LIBS control Remove explicit STATIC from all -impl libraries (server, cli, completion, bench, batched-bench, fit-params, quantize, perplexity) so BUILD_SHARED_LIBS controls shared vs static linkage. Add WINDOWS_EXPORT_ALL_SYMBOLS ON for proper DLL export on Windows. Assisted-by: llama.cpp:local pi --- tools/batched-bench/CMakeLists.txt | 3 ++- tools/cli/CMakeLists.txt | 3 ++- tools/completion/CMakeLists.txt | 3 ++- tools/fit-params/CMakeLists.txt | 3 ++- tools/llama-bench/CMakeLists.txt | 3 ++- tools/perplexity/CMakeLists.txt | 3 ++- tools/quantize/CMakeLists.txt | 3 ++- tools/server/CMakeLists.txt | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/batched-bench/CMakeLists.txt b/tools/batched-bench/CMakeLists.txt index 1769c2136b1e..42b50972f4d1 100644 --- a/tools/batched-bench/CMakeLists.txt +++ b/tools/batched-bench/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-batched-bench-impl) -add_library(${TARGET} STATIC batched-bench.cpp) +add_library(${TARGET} batched-bench.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/cli/CMakeLists.txt b/tools/cli/CMakeLists.txt index 32b660508f09..aa44e586c51e 100644 --- a/tools/cli/CMakeLists.txt +++ b/tools/cli/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-cli-impl) -add_library(${TARGET} STATIC cli.cpp) +add_library(${TARGET} cli.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ../server) target_link_libraries(${TARGET} PUBLIC server-context llama-common ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/completion/CMakeLists.txt b/tools/completion/CMakeLists.txt index 687bdfda6e76..a485bf0a3cbd 100644 --- a/tools/completion/CMakeLists.txt +++ b/tools/completion/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-completion-impl) -add_library(${TARGET} STATIC completion.cpp) +add_library(${TARGET} completion.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/fit-params/CMakeLists.txt b/tools/fit-params/CMakeLists.txt index 207caf2cedad..799c2d74773c 100644 --- a/tools/fit-params/CMakeLists.txt +++ b/tools/fit-params/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-fit-params-impl) -add_library(${TARGET} STATIC fit-params.cpp) +add_library(${TARGET} fit-params.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/llama-bench/CMakeLists.txt b/tools/llama-bench/CMakeLists.txt index ed419a740a6f..2b71faa5f5c6 100644 --- a/tools/llama-bench/CMakeLists.txt +++ b/tools/llama-bench/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-bench-impl) -add_library(${TARGET} STATIC llama-bench.cpp) +add_library(${TARGET} llama-bench.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/perplexity/CMakeLists.txt b/tools/perplexity/CMakeLists.txt index 44061d0a5519..b03d61a41157 100644 --- a/tools/perplexity/CMakeLists.txt +++ b/tools/perplexity/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-perplexity-impl) -add_library(${TARGET} STATIC perplexity.cpp) +add_library(${TARGET} perplexity.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/quantize/CMakeLists.txt b/tools/quantize/CMakeLists.txt index e76f7d81108f..5ef4e4e8a2ea 100644 --- a/tools/quantize/CMakeLists.txt +++ b/tools/quantize/CMakeLists.txt @@ -2,7 +2,8 @@ set(TARGET llama-quantize-impl) -add_library(${TARGET} STATIC quantize.cpp) +add_library(${TARGET} quantize.cpp) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT}) diff --git a/tools/server/CMakeLists.txt b/tools/server/CMakeLists.txt index bf75b199b27e..d87d1a5a5b28 100644 --- a/tools/server/CMakeLists.txt +++ b/tools/server/CMakeLists.txt @@ -31,13 +31,14 @@ target_link_libraries(${TARGET} PUBLIC llama-common mtmd ${CMAKE_THREAD_LIBS_INI set(TARGET llama-server-impl) -add_library(${TARGET} STATIC +add_library(${TARGET} server.cpp server-http.cpp server-http.h server-models.cpp server-models.h ) +set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${TARGET} PRIVATE ../mtmd ${CMAKE_SOURCE_DIR}) From be3e6b19093f5244b418d342f83ddad02c7dce5f Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 21 May 2026 10:32:17 +0300 Subject: [PATCH 2/3] cmake : enable LLAMA_BUILD_APP by default Assisted-by: llama.cpp:local pi --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ed6432b2fd7..56eb608ea0c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ option(LLAMA_BUILD_TESTS "llama: build tests" option(LLAMA_BUILD_TOOLS "llama: build tools" ${LLAMA_STANDALONE}) option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE}) option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE}) -option(LLAMA_BUILD_APP "llama: build the unified binary" OFF) +option(LLAMA_BUILD_APP "llama: build the unified binary" ON) option(LLAMA_BUILD_UI "llama: build the embedded Web UI for server" ON) option(LLAMA_USE_PREBUILT_UI "llama: use prebuilt UI from HF Bucket when available (requires LLAMA_BUILD_UI=ON)" ON) From 7bd176e72a9d0ecef6bc9ef9fbe71666c26d7eff Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 21 May 2026 19:02:28 +0300 Subject: [PATCH 3/3] ci : disable app in build-cmake-pkg.yml --- .github/workflows/build-cmake-pkg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cmake-pkg.yml b/.github/workflows/build-cmake-pkg.yml index 84cf8ddf48ad..6bbfd9988ba9 100644 --- a/.github/workflows/build-cmake-pkg.yml +++ b/.github/workflows/build-cmake-pkg.yml @@ -21,7 +21,7 @@ jobs: PREFIX="$(pwd)"/inst cmake -S . -B build -DCMAKE_PREFIX_PATH="$PREFIX" \ -DLLAMA_OPENSSL=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF \ - -DLLAMA_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release + -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_APP=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release cmake --install build --prefix "$PREFIX" --config Release