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

RFC: should sd.cpp print a version string ...?

Open akleine opened this issue 1 month ago • 0 comments

Hello, what about printing such a version string a the beginning just like this:

$ ./sd_run_my_model_script.sh
**sd.cpp built using commit #15ea27af** 
Option:
    n_threads:                         8
    mode:                              img_gen
    model_path:                        /home/blabla....    
....... etc etc

examples/cli/main.cpp should include a file called "commit_number.h" and later add one line:

#include  "commit_number.h
int main(int argc, const char* argv[]) {
       SDParams params;
       **printf("sd.cpp built using commit #%s\n",COMMIT_SDCPP);**
       parse_args(argc, argv, params);

while commit_number.h is generated by

#!/bin/bash 
COMMIT_SDCPP=$(git rev-parse --short=8 HEAD) 
echo "constexpr const char* COMMIT_SDCPP = \"$COMMIT_SDCPP\";" > commit_number.h

Of course this script should be part of the make process. Making has to be platform independent, also should work if an user fetches the source code without using git.

Unfortunately I do not know very much about cmake (and I never built sd.cpp on Win or Mac) , .... so I won't add a PR now. What do you think ?

akleine avatar Nov 24 '25 09:11 akleine