Skip to content

feat: embed version string and git commit hash#1008

Merged
leejet merged 2 commits into
leejet:masterfrom
wbruna:sd_version_string
Dec 9, 2025
Merged

feat: embed version string and git commit hash#1008
leejet merged 2 commits into
leejet:masterfrom
wbruna:sd_version_string

Conversation

@wbruna

@wbruna wbruna commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

A simple POC for adding a version string to the library and main.cpp (#1005).

The CMake logic comes directly from ggml/CMakeLists.txt. I opted for adding a define to a specific existing source file to make the library easier to build without CMake.

For this test, I added two version strings: a simple commit hash, and a fancier one including the current tag (or last tag and hash if HEAD is not on a tag), and a '+' to indicate file changes:

./sd -v | head -n2
error: the following arguments are required: prompt
stable-diffusion.cpp version master-377-2034588+, commit 2034588
Usage: ./b_w_vulkan/bin/sd [options]

After this commit:

./b_w_vulkan/bin/sd -v | head -n2
error: the following arguments are required: prompt
stable-diffusion.cpp version master-377-2034588-1-gff8abbf, commit ff8abbf
Usage: ./b_w_vulkan/bin/sd [options]

Comment thread examples/cli/main.cpp Outdated
@wbruna wbruna force-pushed the sd_version_string branch from ff8abbf to 3af2c7d Compare December 9, 2025 01:10
@wbruna wbruna changed the title feat: include a version string from git at build time feat: embed version string and git commit hash Dec 9, 2025
@wbruna wbruna marked this pull request as ready for review December 9, 2025 03:10
@leejet leejet merged commit e72aea7 into leejet:master Dec 9, 2025
9 checks passed
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.

2 participants