From b954d399df460c6d180788959cfc042251880240 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 23 Dec 2010 23:17:15 +0000 Subject: [PATCH] - updated vc++ build script to always get the correct SVN revision (must have svnvversion command in the path for the current svn revision to work otherwise it defaults to rev in cpp file) --- mk/windoze/build-mg.bat | 15 ++++++++++++++- source/glest_game/facilities/game_util.cpp | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mk/windoze/build-mg.bat b/mk/windoze/build-mg.bat index 132bb289..080306ff 100644 --- a/mk/windoze/build-mg.bat +++ b/mk/windoze/build-mg.bat @@ -17,6 +17,11 @@ ECHO -------------------------------- Echo Updating Code from SVN to latest Revision... svn update ..\..\ +set SVNVERSION=. +for /f "delims=" %%a in ('svnversion ..\..\ -n') do @set SVNVERSION=%%a +ECHO Will build using SVN Revision: [%SVNVERSION%] +rem pause + ECHO -------------------------------- Echo Touching the build date/time file so we get proper build stamp touch ..\..\source\glest_game\facilities\game_util.cpp @@ -24,7 +29,15 @@ touch ..\..\source\glest_game\facilities\game_util.cpp rem Build Mega-Glest in release mode ECHO -------------------------------- Echo Building Mega-Glest... -msbuild Glest.sln /p:Configuration=Release + +set CL= +del ..\..\source\glest_game\facilities\svnversion.h + +if not "%SVNVERSION%" == "." set CL=/DSVNVERSIONHEADER +if not "%SVNVERSION%" == "." echo building with CL [%CL%] +if not "%SVNVERSION%" == "." echo #define SVNVERSION "%SVNVERSION%" > ..\..\source\glest_game\facilities\svnversion.h + +msbuild /p:Configuration=Release Glest.sln rem pause execution so we can see the output before the batch file exits pause \ No newline at end of file diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index a0b8e248..b478025a 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -30,6 +30,9 @@ const string mailString = "contact@megaglest.org"; const string glestVersionString = "v3.4.0-dev"; #if defined(SVNVERSION) const string SVN_Rev = string("Rev: ") + string(SVNVERSION); +#elif defined(SVNVERSIONHEADER) +#include "svnversion.h" +const string SVN_Rev = string("Rev: ") + string(SVNVERSION); #else const string SVN_Rev = "$Rev$"; #endif