Skip to content

Conversation

@wbruna
Copy link
Contributor

@wbruna wbruna commented Nov 25, 2025

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]

printf("stable-diffusion.cpp version %s, commit %s\n", sd_version(), sd_commit());
}
}
SDParams params;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm grabbing the -v like this just to make it easier to test, since parse_args aborts the program on error.

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.

1 participant