put this in a Scripts folder in your repo and add it as a pre-build script in ProJucer:
VERSION_NUM=`git log -1 --pretty=oneline --abbrev-commit|sed s/\ .*//`
cat > $FILE <<- EOM
const char* const projectName = "Your App Name";
const char* const versionString = "1.0.0 ($VERSION_NUM)";
const int versionNumber = 0x10000;
then in ProJucer, set
JUCE_DONT_DECLARE_PROJECTINFO as a preprocessor definition.
This will automatically generate a
Version.h with your most recent commit number appended to the version number. you could modify it further to read the existing Version.h’s
versionNumber line and bump the value by 1…
The only annoying bit I haven’t figured out how to do yet is to automatically include the “Version.h” in main.cpp and also add it to jucer file.