From e6d3affca37189b23d81795100658e8a531d5bd4 Mon Sep 17 00:00:00 2001 From: APTX Date: Thu, 12 Jan 2012 16:15:06 +0100 Subject: [PATCH] Add some revision and runtime info. --- AniAddCLI.pro | 3 +++ main.cpp | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/AniAddCLI.pro b/AniAddCLI.pro index 283ec1f..17d02ed 100644 --- a/AniAddCLI.pro +++ b/AniAddCLI.pro @@ -7,6 +7,9 @@ TEMPLATE = app SOURCES += main.cpp \ aniaddcli.cpp +REV = $$system(git show-ref -s --verify refs/heads/master) +DEFINES += REVISION=\"$${REV}\" + LIBS += -lanidbudpclient HEADERS += \ diff --git a/main.cpp b/main.cpp index 4ce6d9b..34518cc 100644 --- a/main.cpp +++ b/main.cpp @@ -8,6 +8,9 @@ #include #include "aniaddcli.h" +#define STRINGIFY_INTERNAL(x) #x +#define STRINGIFY(x) STRINGIFY_INTERNAL(x) + QString State2String(AniDBUdpClient::State state) { using namespace AniDBUdpClient; @@ -121,7 +124,17 @@ int main(int argc, char *argv[]) if (opts.count("help")) { cout << QCoreApplication::applicationName() << " v" << QCoreApplication::applicationVersion() - << " by " << QCoreApplication::organizationName() << endl << endl; + << " by " << QCoreApplication::organizationName() << endl; + cout << "Built on " __DATE__ " at " __TIME__ " with Qt" QT_VERSION_STR ", Qxt" QXT_VERSION_STR; +#ifdef REVISION + cout << endl << "\tfrom revision " STRINGIFY(REVISION) "." << endl; +#else + cout << "." << endl; +#endif + if (AniDBUdpClient::revision()) + cout << "AniDBUdpClient revision " << AniDBUdpClient::revision() << "." << endl; + cout << "Running with Qt" << qVersion() << ", Qxt" << qxtVersion() << endl; + cout << endl; opts.showUsage(); return -1; } -- 2.52.0