Program version is now in a const from a generated file, not a static macro. Plus all the mess I had to make to get that to work.

This commit is contained in:
Ben "root" Anderson
2015-01-28 19:21:24 -06:00
parent 0d394e269d
commit 7a33b8a44a
8 changed files with 29 additions and 57 deletions
+2 -5
View File
@@ -17,10 +17,7 @@
#include "Preference.h"
#include "JsonUtil.h"
#include "ScreenInstallOverlay.h"
#if defined(HAVE_VERSION_INFO)
#include "ver.h"
#endif
// only used for Version()
#if defined(_WINDOWS)
@@ -73,7 +70,7 @@ static void LuaInformation()
pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd");
pNode->AppendChild("Version", PRODUCT_ID_VER);
pNode->AppendChild("Version", string(PRODUCT_FAMILY) + product_version);
pNode->AppendChild("Date", DateTime::GetNowDate().GetString());
XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl");
@@ -90,7 +87,7 @@ static void LuaInformation()
static void Version()
{
#if defined(WIN32)
RString sProductID = ssprintf("%s", PRODUCT_ID_VER);
RString sProductID = ssprintf("%s", (string(PRODUCT_FAMILY) + product_version).c_str() );
RString sVersion = "(StepMania was built without HAVE_VERSION_INFO)";
#if defined(HAVE_VERSION_INFO)
sVersion = ssprintf("build %lu\nCompile Date: %s @ %s", version_num, version_date, version_time);
+2 -1
View File
@@ -12,6 +12,7 @@
#include "RageLog.h"
#include "RageTypes.h"
#include "MessageManager.h"
#include "ver.h"
#include <sstream> // conversion for lua functions.
#include <csetjmp>
@@ -1040,7 +1041,7 @@ void LuaHelpers::PushValueFunc( lua_State *L, int iArgs )
#include "ProductInfo.h"
LuaFunction( ProductFamily, (RString) PRODUCT_FAMILY );
LuaFunction( ProductVersion, (RString) PRODUCT_VER );
LuaFunction( ProductVersion, (RString) product_version );
LuaFunction( ProductID, (RString) PRODUCT_ID );
extern const char *const version_date;
+17 -18
View File
@@ -19,7 +19,6 @@ AM_CFLAGS =
noinst_LIBRARIES =
EXTRA_DIST =
AM_CXXFLAGS += -fno-exceptions
# Relax inlining; the default of 600 takes way too long to compile and
@@ -28,31 +27,31 @@ AM_CXXFLAGS += -finline-limit=300
AM_CXXFLAGS += $(GL_CFLAGS)
.PHONY: increment_version gitversion
.PHONY: update_version
increment_version:
update_version:
if test -e ver.cpp; then \
build=`sed -rs 's/.*version_num = ([[:digit:]]+);/\1/;q' ver.cpp`; \
build=`sed -rs 's/.*version_num = ([[:digit:]]+);/\1/;2q;d' ver.cpp`; \
build=`expr $$build + 1`; \
else \
build=0; \
fi; \
echo "const unsigned long version_num = $$build;" > ver.cpp; \
echo "const char *const version_time = \"`date +"%X %Z (UTC%:z)"`\";" >> ver.cpp;
echo "const char *const version_date = \"`date +"%Y%m%d"`\";" >> ver.cpp;
ver.cpp: increment_version
gitversion:
rm -f gitversion.h
touch gitversion.h
echo "#include \"ver.h\"" > ver.cpp; \
echo "const unsigned long version_num = $$build;" >> ver.cpp
# Header inclusion necessary to get linker symbols right
echo "const char *const version_time = \"`date +"%X %Z (UTC%:z)"`\";" >> ver.cpp
echo "const char *const version_date = \"`date +"%Y%m%d"`\";" >> ver.cpp
if git rev-parse --short HEAD; then \
echo "#define PRODUCT_VER_BARE 5.0-git-`git rev-parse --short HEAD`" > gitversion.h; \
echo "const char *const product_version = \"5.0-git-`git rev-parse --short HEAD`\";" >> ver.cpp; \
else \
echo "const char *const product_version = \"5.0-UNKNOWN\";" >> ver.cpp; \
fi
gitversion.h: gitversion
BUILT_SOURCES = gitversion.h ver.cpp
ver.cpp: update_version
# make doesn't recognize a file it updated during the current invocation
# (in this case ver.cpp) as being updated. So remake and delete stepmania-ver.o
# every time.
.INTERMEDIATE: stepmania-ver.o
PNG = \
../extern/libpng/include/png.c ../extern/libpng/include/.png.h \
@@ -745,7 +744,7 @@ main_LDADD = \
$(GL_LIBS) \
libtomcrypt.a libtommath.a
nodist_stepmania_SOURCES = ver.cpp gitversion.h
nodist_stepmania_SOURCES = ver.cpp
stepmania_CPPFLAGS = $(main_CPPFLAGS)
stepmania_SOURCES = $(main_SOURCES)
+1 -1
View File
@@ -166,7 +166,7 @@ void NetworkSyncManager::PostStartUp( const RString& ServerIP )
m_packet.Write1( NETPROTOCOLVERSION );
m_packet.WriteNT( RString(PRODUCT_ID_VER) );
m_packet.WriteNT( RString( string(PRODUCT_FAMILY) + product_version ) );
/* Block until response is received.
* Move mode to blocking in order to give CPU back to the system,
-27
View File
@@ -5,9 +5,6 @@
// XXX: VC doesn't generate this yet. Hack around it for now
#include "config.h"
#ifdef USE_GITVERSION
#include "gitversion.h"
#endif
/**
* @brief A friendly string to refer to the product in crash dialogs, etc.
@@ -24,36 +21,12 @@
*/
#define PRODUCT_ID_BARE StepMania 5.0
/**
* @brief Version info displayed to the user.
*
* These are the 'official' version designations:
* <ul>
* <li>"v5.0 alpha #": Alpha versions (bug squashing, polishing until we reach beta)</li>
* <li>"v5.0 beta #": Beta versions (bug squashing, _focus_ is on high priority bugs)</li>
* <li>"v5.0 rc#": Release Candidates (if there are no problems, move on to final)</li>
* <li>"v5.0.0": Final Releases</li>
* </li></ul>
*/
#ifndef PRODUCT_VER_BARE
#define PRODUCT_VER_BARE 5.0-UNKNOWN
#endif
/**
* @brief A unique ID for a build of an application.
*
* This is used in crash reports and in the network code's version handling.
*/
#define PRODUCT_ID_VER_BARE PRODUCT_FAMILY_BARE PRODUCT_VER_BARE
// These cannot be #undef'd so make them unlikely to conflict with anything
#define PRODUCT_STRINGIFY(x) #x
#define PRODUCT_XSTRINGIFY(x) PRODUCT_STRINGIFY(x)
#define PRODUCT_FAMILY PRODUCT_XSTRINGIFY(PRODUCT_FAMILY_BARE)
#define PRODUCT_ID PRODUCT_XSTRINGIFY(PRODUCT_ID_BARE)
#define PRODUCT_VER PRODUCT_XSTRINGIFY(PRODUCT_VER_BARE)
#define PRODUCT_ID_VER PRODUCT_XSTRINGIFY(PRODUCT_ID_VER_BARE)
#define VIDEO_TROUBLESHOOTING_URL "http://old.stepmania.com/stepmaniawiki.php?title=Video_Driver_Troubleshooting"
/** @brief The URL to report bugs on the program. */
+3 -2
View File
@@ -6,8 +6,9 @@
; PRODUCT_ID must NOT be "StepMania" unless you want people to uninstall 3.9
; when they install StepMania 5. (not recommended)
!define PRODUCT_ID "StepMania 5"
!define PRODUCT_VER "v5.0 beta 4a"
!define PRODUCT_ID "StepMania 5.0"
; TODO: This needs to be updated with the git rev hash
!define PRODUCT_VER "5.0-UNKNOWN"
!define PRODUCT_DISPLAY "${PRODUCT_FAMILY} ${PRODUCT_VER}"
!define PRODUCT_BITMAP "sm5"
+1 -1
View File
@@ -914,7 +914,7 @@ static void MountTreeOfZips( const RString &dir )
static void WriteLogHeader()
{
LOG->Info( PRODUCT_ID_VER );
LOG->Info( RString(PRODUCT_FAMILY) + product_version );
#if defined(HAVE_VERSION_INFO)
LOG->Info( "Compiled %s @ %s (build %lu)", version_date, version_time, version_num );
+3 -2
View File
@@ -25,6 +25,7 @@
#include "XmlFileUtil.h"
#include "LocalizedString.h"
#include "RageFileDriverDeflate.h"
#include "ver.h"
#if defined(_MSC_VER)
#pragma comment(lib, "archutils/Win32/ddk/dbghelp.lib")
@@ -434,7 +435,7 @@ static void MakeCrashReport( const CompleteCrashData &Data, RString &sOut )
sOut += ssprintf(
"%s crash report (build %d, %s @ %s)\n"
"--------------------------------------\n\n",
PRODUCT_ID_VER, version_num, version_date, version_time );
(string(PRODUCT_FAMILY) + product_version).c_str(), version_num, version_date, version_time );
sOut += ssprintf( "Crash reason: %s\n", Data.m_CrashInfo.m_CrashReason );
sOut += ssprintf( "\n" );
@@ -737,7 +738,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
// Create the form data to send.
m_pPost = new NetworkPostData;
m_pPost->SetData( "Product", PRODUCT_ID );
m_pPost->SetData( "Version", PRODUCT_VER );
m_pPost->SetData( "Version", product_version );
m_pPost->SetData( "Arch", HOOKS->GetArchName().c_str() );
m_pPost->SetData( "Report", m_sCrashReport );
m_pPost->SetData( "Reason", m_CrashData.m_CrashInfo.m_CrashReason );