simplify GC_BUILD_DATE and GC_VERSION

Use gcc macros for __TIME__ and __DATE__ to compute build date.  This has the
advantage that we don't have to shell out to find the date, though it has the
disadvantage that it doesn't give us any control over format, nor does it
report the time zone.

By default, set GC_VERSION to "(developer build)".  For release versions,
specify GC_VERSION explicitly in gcconfig.pri like this:

  QMAKE_CXXFLAGS += -DGC_VERSION="'\"1.2.0\"'"

It would be nice to specify the git commit id in developer builds.  On the
other hand, the developer could always have uncommitted changes, so the git
commit id doesn't really make for a completely reproducible build.  It's also
a pain to get ahold of in Windows.
This commit is contained in:
Sean Rhea
2009-09-07 16:56:57 -04:00
parent af676f24eb
commit 6eeea4a305
2 changed files with 12 additions and 47 deletions

View File

@@ -51,20 +51,8 @@
#include "MetricAggregator.h"
#include "SplitRideDialog.h"
#ifdef WIN32
#include "temp_version.h"
#define GC_SVN_VERSION g_svnversion
#define GC_BUILD_DATE g_builddate
#else
/* temp for the qmake/QMAKE_CXXFLAGS bug with xcode */
#ifndef GC_SVN_VERSION
#define GC_SVN_VERSION "0"
#endif
#ifndef GC_BUILD_DATE
#define GC_BUILD_DATE GC_SVN_VERSION
#endif
#ifndef GC_VERSION
#define GC_VERSION "(developer build)"
#endif
#define FOLDER_TYPE 0
@@ -2024,9 +2012,8 @@ MainWindow::aboutDialog()
"<h2>GoldenCheetah</h2>"
"<i>Cycling Power Analysis Software for Linux, Mac, and Windows</i>"
"<p><i>Build date: "
"") + QString(GC_BUILD_DATE).replace("_", " ") + ("</i>"
"<p><i>Version: "
"")+QString::number(GC_MAJOR_VER)+(".") +QString::number(GC_MINOR_VER)+(".")+QString::number(GC_BUILD_VER) + ("</i>"
"") + QString(__DATE__) + " " + QString(__TIME__) + "</i>"
"<p><i>Version: " + QString(GC_VERSION) + ("</i>"
"<p>GoldenCheetah is licensed under the "
"<a href=\"http://www.gnu.org/copyleft/gpl.html\">GNU General "
"Public License</a>."

View File

@@ -11,11 +11,6 @@ QT += xml sql
LIBS += $${QWT_LIB}
LIBS += -lm
!win32 {
QMAKE_CXXFLAGS += -DGC_BUILD_DATE="`date +'\"%a_%b_%d,_%Y\"'`"
QMAKE_CXXFLAGS += -DGC_SVN_VERSION=\\\"`svnversion . | cut -f '2' -d ':'`\\\"
}
!isEmpty( D2XX_INCLUDE ) {
INCLUDEPATH += $${D2XX_INCLUDE}
HEADERS += D2XX.h
@@ -29,10 +24,6 @@ LIBS += -lm
SOURCES += SrmDevice.cpp
}
QMAKE_CXXFLAGS += -DGC_MAJOR_VER=1
QMAKE_CXXFLAGS += -DGC_MINOR_VER=2
QMAKE_CXXFLAGS += -DGC_BUILD_VER=0
macx {
LIBS += -framework Carbon
}
@@ -42,6 +33,14 @@ macx {
HEADERS += Serial.h
SOURCES += Serial.cpp
}
win32 {
INCLUDEPATH += ./win32
LIBS += -lws2_32
QMAKE_LFLAGS = -Wl,--enable-runtime-pseudo-reloc \
-Wl,--script,win32/i386pe.x-no-rdata
//QMAKE_CXXFLAGS += -fdata-sections
RC_FILE = windowsico.rc
}
HEADERS += \
AllPlot.h \
@@ -136,26 +135,5 @@ SOURCES += \
ManualRideDialog.cpp \
RideCalendar.cpp
win32 {
INCLUDEPATH += ./win32
LIBS += -lws2_32
QMAKE_LFLAGS = -Wl,--enable-runtime-pseudo-reloc \
-Wl,--script,win32/i386pe.x-no-rdata
//QMAKE_CXXFLAGS += -fdata-sections
RC_FILE = windowsico.rc
QMAKE_EXTRA_TARGETS += revtarget
PRE_TARGETDEPS += temp_version.h
revtarget.target = temp_version.h
revtarget.commands = @echo "const char * const g_builddate = \"$(shell date /t)\";" \
"const char * const g_svnversion = \"$(shell svnversion .)\";" > $$revtarget.target
# this line has to be after SOURCES and HEADERS is declared or it doesn't work
revtarget.depends = $$SOURCES $$HEADERS $$FORMS
}
RESOURCES = application.qrc