Skip to content

Conversation

cmdr2
Copy link
Contributor

@cmdr2 cmdr2 commented Nov 19, 2024

Hi, this PR allows the creation of two separate libs (e.g. ggml.dll and stable-diffusion.dll) via a build option (SD_BUILD_SHARED_GGML_LIB). By default, it continues to make a single shared lib (like it does today).

cmake -B build -DSD_BUILD_SHARED_LIBS=1 -DSD_BUILD_SHARED_GGML_LIB=1

This option is useful when distributing updates to programs that use sd.cpp internally. For e.g. when targeting CUDA, with this PR, new versions of stable-diffusion.cpp can be distributed with a 4 MB DLL update, instead of re-distributing 347 MB (that includes ggml with compiled ggml CUDA kernels).

ggml doesn't need to change frequently, so there isn't much point wasting bandwidth redistributing the entire static-ly built ggml (with cuda), each time stable-diffusion.dll needs to be updated.

I've tested this on Windows, Mac and Linux (Ubuntu).

Please let me know if this PR needs anything else, thanks!

@ItzCrazyKns
Copy link

+1

…ing to stable-diffusion.cpp as a static library
@wbruna
Copy link
Contributor

wbruna commented Jun 19, 2025

LGTM; tested on a few local builds.

@leejet leejet merged commit a7d6d29 into leejet:master Oct 15, 2025
8 checks passed
@leejet
Copy link
Owner

leejet commented Oct 15, 2025

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants