@@ -33,6 +33,7 @@ option(SD_SYCL "sd: sycl backend" OFF)
3333option (SD_MUSA "sd: musa backend" OFF )
3434option (SD_FAST_SOFTMAX "sd: x1.5 faster softmax, indeterministic (sometimes, same seed don't generate same image), cuda only" OFF )
3535option (SD_BUILD_SHARED_LIBS "sd: build shared libs" OFF )
36+ option (SD_BUILD_SHARED_GGML_LIB "sd: build ggml as a separate shared lib" OFF )
3637option (SD_USE_SYSTEM_GGML "sd: use system-installed GGML library" OFF )
3738#option(SD_BUILD_SERVER "sd: build server example" ON)
3839
@@ -86,18 +87,21 @@ file(GLOB SD_LIB_SOURCES
8687 "*.hpp"
8788)
8889
89- # we can get only one share lib
9090if (SD_BUILD_SHARED_LIBS)
9191 message ("-- Build shared library" )
9292 message (${SD_LIB_SOURCES} )
93- set (BUILD_SHARED_LIBS OFF )
93+ if (NOT SD_BUILD_SHARED_GGML_LIB)
94+ set (BUILD_SHARED_LIBS OFF )
95+ endif ()
9496 add_library (${SD_LIB} SHARED ${SD_LIB_SOURCES} )
9597 add_definitions (-DSD_BUILD_SHARED_LIB)
9698 target_compile_definitions (${SD_LIB} PRIVATE -DSD_BUILD_DLL)
9799 set (CMAKE_POSITION_INDEPENDENT_CODE ON )
98100else ()
99101 message ("-- Build static library" )
100- set (BUILD_SHARED_LIBS OFF )
102+ if (NOT SD_BUILD_SHARED_GGML_LIB)
103+ set (BUILD_SHARED_LIBS OFF )
104+ endif ()
101105 add_library (${SD_LIB} STATIC ${SD_LIB_SOURCES} )
102106endif ()
103107
0 commit comments