Specjalistyczne rozwiązania informatyczne

Combine subversion information with windows executable

It's useful to append svn repository information before you build your .exe file. TortoiseSVN package contains simple tool we need - subwcrev. Let's create resource .rc template, which we will parse with this tool:

#include "repo_version.h"
STRINGTABLE
{
 repo_version, "$WCREV$"
 repo_commit, "$WCDATE$"
 repo_now, "$WCNOW$"
 repo_modified, "$WCMODS?*:$"
}

VERSIONINFO_1 VERSIONINFO
FILEVERSION 1, $WCREV$, 0, 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
 BLOCK "StringFileInfo"
 {
  BLOCK "040904E4"
  {
    VALUE "FileVersion", "$WCMODS?modified:$ v$WCREV$ build $WCNOW$\000\000"
    VALUE "InternalName", "yourapp\000"
    VALUE "OriginalFilename", "yourapp.exe\000"
  }
 }
}

Now we can execute subwcrev:

subwcrev.exe c:\svn_project_rootdir repo_version.rc.orig repo_version.rc

In output file we will get two blocks:

   © KLASTER 2017