stable-diffusion.cpp icon indicating copy to clipboard operation
stable-diffusion.cpp copied to clipboard

feat: embed version string and git commit hash

Open wbruna opened this issue 1 month ago • 0 comments

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]

wbruna avatar Nov 25 '25 21:11 wbruna