From 1dbe8335799ace31ff49ad51edc6e36571c475f0 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 13 Nov 2010 18:58:55 +0000 Subject: [PATCH] Use updated version.h if available. Add single fallback header if version.h is missing. --- src/Include/no_version.h | 16 ++++++++++++++++ src/Include/version.h.in | 2 +- src/Instrumentation/mk_viii.cxx | 6 +++++- src/Main/options.cxx | 16 +++++++++++++--- 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 src/Include/no_version.h diff --git a/src/Include/no_version.h b/src/Include/no_version.h new file mode 100644 index 000000000..4e33838b8 --- /dev/null +++ b/src/Include/no_version.h @@ -0,0 +1,16 @@ +#ifndef FG_NO_VERSION_H +#define FG_NO_VERSION_H + +// version.h is generated by the build system for official builds of +// FlightGear. To avoid complicating the life of regular developers, +// especially on Windows, we set HAVE_VERSION_H if version.h is generated. +// If that define is not set, we include this file instead, which provides +// placeholder values instead. + +#define FLIGHTGEAR_VERSION "development " __DATE__ + +#define HUDSON_BUILD_NUMBER 0 +#define HUDSON_BUILD_ID "none" +#define REVISION "unknown" + +#endif \ No newline at end of file diff --git a/src/Include/version.h.in b/src/Include/version.h.in index f8524a3c6..4d1f692ef 100644 --- a/src/Include/version.h.in +++ b/src/Include/version.h.in @@ -28,7 +28,7 @@ #define FLIGHTGEAR_VERSION "@VERSION@" -#define HUDSON_BUILD_NUMBER "@HUDSON_BUILD_NUMBER@" +#define HUDSON_BUILD_NUMBER @HUDSON_BUILD_NUMBER@ #define HUDSON_BUILD_ID "@HUDSON_BUILD_ID@" #define REVISION "@REVISION@" diff --git a/src/Instrumentation/mk_viii.cxx b/src/Instrumentation/mk_viii.cxx index d69cc96ad..223ab6136 100755 --- a/src/Instrumentation/mk_viii.cxx +++ b/src/Instrumentation/mk_viii.cxx @@ -76,9 +76,13 @@ using std::string; #include #include -#ifndef _MSC_VER + +#ifdef HAVE_VERSION_H # include +#else +# include #endif + #include
#include
#include "instrument_mgr.hxx" diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 4eebeead5..cf8317a79 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -64,8 +64,10 @@ using std::cout; using std::cerr; using std::endl; -#ifndef VERSION -#define VERSION "CVS "__DATE__ +#ifdef HAVE_VERSION_H +# include +#else +# include #endif #define NEW_DEFAULT_MODEL_HZ 120 @@ -233,6 +235,12 @@ fgSetDefaults () fgSetString("/sim/multiplay/txhost", "0"); fgSetInt("/sim/multiplay/rxport", 0); fgSetInt("/sim/multiplay/txport", 0); + + fgSetString("/sim/version/flightgear", FLIGHTGEAR_VERSION); + //fgSetString("/sim/version/simgear", FLIGHTGEAR_VERSION); + fgSetString("/sim/version/revision", REVISION); + fgSetInt("/sim/version/build-number", HUDSON_BUILD_NUMBER); + fgSetString("/sim/version/build-id", HUDSON_BUILD_ID); } static bool @@ -1208,7 +1216,9 @@ fgOptParking( const char *arg ) static int fgOptVersion( const char *arg ) { - cerr << "FlightGear version: " << VERSION << endl; + cerr << "FlightGear version: " << FLIGHTGEAR_VERSION << endl; + cerr << "Revision: " << REVISION << endl; + cerr << "Build-Id: " << HUDSON_BUILD_ID << endl; cerr << "FG_ROOT=" << globals->get_fg_root() << endl; cerr << "FG_HOME=" << fgGetString("/sim/fg-home") << endl; cerr << "FG_SCENERY=";