"New", nicer solution for including the SVN revision information in Windows builds.

Originally committed to SVN as r1170.
This commit is contained in:
Niels Martin Hansen 2007-05-08 00:06:39 +00:00
parent b22a47f842
commit 15fb8e8fdb
2 changed files with 27 additions and 5 deletions

View File

@ -0,0 +1,10 @@
// This file is intended as a template for the TortoiseSVN tool SubWCRev
// Set up your project so it runs a command similar to this as pre-build event:
//"C:\Program Files\TortoiseSVN\bin\SubWCRev.exe" "$(SolutionDir)../aegisub" "$(SolutionDir)../aegisub/build/svn-revision-base.h" "$(SolutionDir)../aegisub/build/svn-revision.h"
// Of course make sure the relative paths etc. match your system
// Do not add or commit the resulting file to SVN.
#define BUILD_SVN_REVISION $WCREV$
#define BUILD_SVN_DATE "$WCDATE$"
#define BUILD_SVN_LOCALMODS $WCMODS?true:false$

View File

@ -59,8 +59,8 @@
#define BUILD_TIMESTAMP _T_rec(__DATE__) _T(" ") _T_rec(__TIME__)
// If the BUILD_SVN_REVISION happens to be negative, the build is assumed to be a public-release build (ie. not prerel)
// So manually edit build/svn-revision.h to match that, when doing such a build, or add some other magic to do that.
// Define FINAL_RELEASE to mark a build as a "final" version, ie. not pre-release version
// In that case it won't include the SVN revision information
struct VersionInfoStruct {
// Some raw data
@ -87,17 +87,29 @@ struct VersionInfoStruct {
IsDebug = false;
#endif
SvnRev = BUILD_SVN_REVISION;
#ifdef BUILD_SVN_DATE
BuildTime = _T_rec(BUILD_SVN_DATE);
#else
BuildTime = BUILD_TIMESTAMP;
#endif
BuildCredit = _T_rec(BUILD_CREDIT);
if (SvnRev > 0)
if (SvnRev > 0) {
SCMStr = wxString::Format(_T("SVN r%d"), SvnRev);
#ifdef BUILD_SVN_LOCALMODS
SCMStr += BUILD_SVN_LOCALMODS ? _T("M") : _T("");
#endif
#ifdef BUILD_DARCS
else
} else {
SCMStr = _T("darcs");
#endif
}
IsRelease = SvnRev < 0;
#ifdef FINAL_RELEASE
IsRelease = true;
#else
IsRelease = false;
#endif
VersionStr = wxString::Format(_T("%s%s"), VersionNumber, IsRelease ? _T("") : _T(" PRE-RELEASE"));
LongVersionString = wxString::Format(_T("%s (%s%s, %s)"), VersionStr.c_str(), IsDebug ? _T("debug, ") : _T(""), SCMStr.c_str(), BuildCredit);