Skip to content

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

@akleine

Description

@akleine

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions