From 9f438b1bccca459e484560232e5b6e7dfdbacd61 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 29 Sep 2013 19:54:02 -0700 Subject: Automatically generate version information --- src/common/version.cpp | 28 ++++++++++++++++++++++++++++ src/common/version.hpp | 47 ++++++++--------------------------------------- src/conf/version.hpp | 15 +++++++++++++++ 3 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 src/common/version.cpp create mode 100644 src/conf/version.hpp (limited to 'src') diff --git a/src/common/version.cpp b/src/common/version.cpp new file mode 100644 index 0000000..7f4a0f2 --- /dev/null +++ b/src/common/version.cpp @@ -0,0 +1,28 @@ +#include "version.hpp" + +#include "../conf/version.hpp" + +Version CURRENT_LOGIN_SERVER_VERSION = +{ + VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, + VERSION_DEVEL, + + 0, TMWA_SERVER_LOGIN, + VENDOR_VERSION, +}; +Version CURRENT_CHAR_SERVER_VERSION = +{ + VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, + VERSION_DEVEL, + + 0, TMWA_SERVER_CHAR | TMWA_SERVER_INTER, + VENDOR_VERSION, +}; +Version CURRENT_MAP_SERVER_VERSION = +{ + VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, + VERSION_DEVEL, + + 0, TMWA_SERVER_MAP, + VENDOR_VERSION, +}; diff --git a/src/common/version.hpp b/src/common/version.hpp index 30c619c..e34ec50 100644 --- a/src/common/version.hpp +++ b/src/common/version.hpp @@ -1,14 +1,7 @@ -#ifndef VERSION_HPP -#define VERSION_HPP +#ifndef TMWA_COMMON_VERSION_HPP +#define TMWA_COMMON_VERSION_HPP -// TODO generate this from ./configure -// Actually, it should be done from the Makefile -// it should be possible to use a ./config.status for a long time - -# define TMWA_VERSION_MAJOR 13 -# define TMWA_VERSION_MINOR 9 -# define TMWA_VERSION_PATCH 29 -# define TMWA_DEVELOP_FLAG 1 +# include // TODO make these bitwise enums # define TMWA_FLAG_REGISTRATION 0x01 @@ -18,9 +11,6 @@ # define TMWA_SERVER_INTER 0x04 # define TMWA_SERVER_MAP 0x08 -# define TMWA_VENDOR "Vanilla" -# define TMWA_VENDOR_VERSION 0 - struct Version { uint8_t major; @@ -33,31 +23,10 @@ struct Version uint16_t vend; // can't add vendor name yet }; -static_assert(sizeof(Version) == 8, "this is send over the network, can't change"); - -constexpr Version CURRENT_LOGIN_SERVER_VERSION = -{ - TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH, - TMWA_DEVELOP_FLAG, +static_assert(sizeof(Version) == 8, "this is sent over the network, can't change"); - 0, TMWA_SERVER_LOGIN, - TMWA_VENDOR_VERSION, -}; -constexpr Version CURRENT_CHAR_SERVER_VERSION = -{ - TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH, - TMWA_DEVELOP_FLAG, - - 0, TMWA_SERVER_CHAR | TMWA_SERVER_INTER, - TMWA_VENDOR_VERSION, -}; -constexpr Version CURRENT_MAP_SERVER_VERSION = -{ - TMWA_VERSION_MAJOR, TMWA_VERSION_MINOR, TMWA_VERSION_PATCH, - TMWA_DEVELOP_FLAG, - - 0, TMWA_SERVER_MAP, - TMWA_VENDOR_VERSION, -}; +extern Version CURRENT_LOGIN_SERVER_VERSION; +extern Version CURRENT_CHAR_SERVER_VERSION; +extern Version CURRENT_MAP_SERVER_VERSION; -#endif // VERSION_HPP +#endif // TMWA_COMMON_VERSION_HPP diff --git a/src/conf/version.hpp b/src/conf/version.hpp new file mode 100644 index 0000000..1da6088 --- /dev/null +++ b/src/conf/version.hpp @@ -0,0 +1,15 @@ +#ifndef CONF_VERSION_HPP +#define CONF_VERSION_HPP + +#include "conf-raw/str-VERSION_FULL.h" +#include "conf-raw/str-VERSION_HASH.h" + +#include "conf-raw/int-VERSION_MAJOR.h" +#include "conf-raw/int-VERSION_MINOR.h" +#include "conf-raw/int-VERSION_PATCH.h" +#include "conf-raw/int-VERSION_DEVEL.h" + +#include "conf-raw/str-VENDOR.h" +#include "conf-raw/int-VENDOR_VERSION.h" + +#endif -- cgit v1.2.3-70-g09d2