- added proper SVN revision handling for CMAKE builds so now the --version and main menu display proper SVN Global Revision #

This commit is contained in:
Mark Vejvoda 2010-12-10 01:53:51 +00:00
parent 045c2f95e8
commit 679557c6f2
3 changed files with 41 additions and 13 deletions

View File

@ -97,6 +97,30 @@ ENDFOREACH(DIR)
# [RCL] FIXME: make it compiler-agnostic
SET(CMAKE_CXX_FLAGS "-O3 -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DSTREFLOP_SSE")
# The stuff below gets SVN Global Revision # but ONLY when calling cmake!
# the FindSubversion.cmake module is part of the standard distribution
include(FindSubversion)
# extract working copy information for SOURCE_DIR into MY_XXX variables
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} MG)
#add_definitions(-DSVNVERSION="${MG_WC_REVISION}")
SET(SVN_VERSION_CMD -DSVNVERSION="${MG_WC_REVISION}")
IF(UNIX AND NOT APPLE)
# We do some funky character escaping to get the right stuff written out to
# the final Makefile so we get the SVN Global Revsion #
SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"`svnversion -n ${PROJECT_SOURCE_DIR}`\\\"'")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SVN_VERSION_CMD}")
IF(UNIX AND NOT APPLE)
# We do some funky character escaping to get the right stuff written out to
# the final Makefile so we get the SVN Global Revsion #
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
SET(TARGET_NAME "glest.bin")
IF(UNIX AND NOT APPLE)

View File

@ -28,7 +28,11 @@ namespace Glest { namespace Game {
const string mailString = "contact_game@glest.org";
const string glestVersionString = "v3.4.0-dev";
#if defined(SVNVERSION)
const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
#else
const string SVN_Rev = "$Rev$";
#endif
string getCrashDumpFileName(){
return "glest" + glestVersionString + ".dmp";

View File

@ -59,7 +59,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
buttonExit.registerGraphicComponent(containerName,"buttonExit");
buttonExit.init(425, i, 150);
labelVersion.registerGraphicComponent(containerName,"labelVersion");
labelVersion.init(435, 420);
labelVersion.init(405, 420);
buttonNewGame.setText(lang.get("NewGame"));
buttonJoinGame.setText(lang.get("JoinGame"));
@ -67,7 +67,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
buttonOptions.setText(lang.get("Options"));
buttonAbout.setText(lang.get("About"));
buttonExit.setText(lang.get("Exit"));
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + "]");
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]");
//mesage box
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");