Skip to content

Commit 6167e29

Browse files
authored
feat: support build against system installed GGML library (#749)
1 parent f6b9aa1 commit 6167e29

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ option(SD_SYCL "sd: sycl backend" OFF)
3333
option(SD_MUSA "sd: musa backend" OFF)
3434
option(SD_FAST_SOFTMAX "sd: x1.5 faster softmax, indeterministic (sometimes, same seed don't generate same image), cuda only" OFF)
3535
option(SD_BUILD_SHARED_LIBS "sd: build shared libs" OFF)
36+
option(SD_USE_SYSTEM_GGML "sd: use system-installed GGML library" OFF)
3637
#option(SD_BUILD_SERVER "sd: build server example" ON)
3738

3839
if(SD_CUDA)
@@ -124,7 +125,15 @@ add_definitions(-DGGML_MAX_NAME=128)
124125
# deps
125126
# Only add ggml if it hasn't been added yet
126127
if (NOT TARGET ggml)
127-
add_subdirectory(ggml)
128+
if (SD_USE_SYSTEM_GGML)
129+
find_package(ggml REQUIRED)
130+
if (NOT ggml_FOUND)
131+
message(FATAL_ERROR "System-installed GGML library not found.")
132+
endif()
133+
add_library(ggml ALIAS ggml::ggml)
134+
else()
135+
add_subdirectory(ggml)
136+
endif()
128137
endif()
129138

130139
add_subdirectory(thirdparty)

0 commit comments

Comments
 (0)