Skip to content

Commit bb28c1f

Browse files
authored
cmake : remove STATIC from impl libraries, enable LLAMA_BUILD_APP by default (ggml-org#23462)
* 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 * cmake : enable LLAMA_BUILD_APP by default Assisted-by: llama.cpp:local pi * ci : disable app in build-cmake-pkg.yml
1 parent ee7c305 commit bb28c1f

10 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/build-cmake-pkg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
PREFIX="$(pwd)"/inst
2222
cmake -S . -B build -DCMAKE_PREFIX_PATH="$PREFIX" \
2323
-DLLAMA_OPENSSL=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF \
24-
-DLLAMA_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
24+
-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_APP=OFF -DCMAKE_BUILD_TYPE=Release
2525
cmake --build build --config Release
2626
cmake --install build --prefix "$PREFIX" --config Release
2727

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ option(LLAMA_BUILD_TESTS "llama: build tests"
108108
option(LLAMA_BUILD_TOOLS "llama: build tools" ${LLAMA_STANDALONE})
109109
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
110110
option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE})
111-
option(LLAMA_BUILD_APP "llama: build the unified binary" OFF)
111+
option(LLAMA_BUILD_APP "llama: build the unified binary" ON)
112112
option(LLAMA_BUILD_UI "llama: build the embedded Web UI for server" ON)
113113
option(LLAMA_USE_PREBUILT_UI "llama: use prebuilt UI from HF Bucket when available (requires LLAMA_BUILD_UI=ON)" ON)
114114

tools/batched-bench/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-batched-bench-impl)
44

5-
add_library(${TARGET} STATIC batched-bench.cpp)
5+
add_library(${TARGET} batched-bench.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/cli/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-cli-impl)
44

5-
add_library(${TARGET} STATIC cli.cpp)
5+
add_library(${TARGET} cli.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ../server)
89
target_link_libraries(${TARGET} PUBLIC server-context llama-common ${CMAKE_THREAD_LIBS_INIT})

tools/completion/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-completion-impl)
44

5-
add_library(${TARGET} STATIC completion.cpp)
5+
add_library(${TARGET} completion.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/fit-params/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-fit-params-impl)
44

5-
add_library(${TARGET} STATIC fit-params.cpp)
5+
add_library(${TARGET} fit-params.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/llama-bench/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-bench-impl)
44

5-
add_library(${TARGET} STATIC llama-bench.cpp)
5+
add_library(${TARGET} llama-bench.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/perplexity/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-perplexity-impl)
44

5-
add_library(${TARGET} STATIC perplexity.cpp)
5+
add_library(${TARGET} perplexity.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/quantize/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set(TARGET llama-quantize-impl)
44

5-
add_library(${TARGET} STATIC quantize.cpp)
5+
add_library(${TARGET} quantize.cpp)
6+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
67

78
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
89
target_link_libraries(${TARGET} PUBLIC llama-common llama ${CMAKE_THREAD_LIBS_INIT})

tools/server/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ target_link_libraries(${TARGET} PUBLIC llama-common mtmd ${CMAKE_THREAD_LIBS_INI
3131

3232
set(TARGET llama-server-impl)
3333

34-
add_library(${TARGET} STATIC
34+
add_library(${TARGET}
3535
server.cpp
3636
server-http.cpp
3737
server-http.h
3838
server-models.cpp
3939
server-models.h
4040
)
41+
set_target_properties(${TARGET} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
4142

4243
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
4344
target_include_directories(${TARGET} PRIVATE ../mtmd ${CMAKE_SOURCE_DIR})

0 commit comments

Comments
 (0)