Fixes version generation, no longer derives version on git tags.

We were stuck on the 4.5.0 tag from develop, since we searched for the
latest tag, but release tags are done on the master branch.

This commit rips out all the code for deriving the version on git tags.

Instead, we define major, minor, and patch versions in the CMakeLists
and then pass it on to:

- the `libosrm.pc` `pkg-config` file

- a `version.hpp` header that makes use of the preprocessor's string
  concatenation to provide an easy way for generating version string
  literals such as "v4.8.0".

That is, in the source code please now use the following defines:

    #define OSRM_VERSION_MAJOR "@OSRM_VERSION_MAJOR@"
    #define OSRM_VERSION_MINOR "@OSRM_VERSION_MINOR@"
    #define OSRM_VERSION_PATCH "@OSRM_VERSION_PATCH@"

    #define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH
This commit is contained in:
Daniel J. Hofmann
2015-09-11 11:37:02 +02:00
parent 0424ff0818
commit 809bdb7c1f
17 changed files with 49 additions and 201 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DATASTORE_OPTIONS_HPP
#define DATASTORE_OPTIONS_HPP
#include "git_sha.hpp"
#include "version.hpp"
#include "ini_file.hpp"
#include "osrm_exception.hpp"
#include "simple_logger.hpp"
@@ -107,7 +107,7 @@ bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &p
if (option_variables.count("version"))
{
SimpleLogger().Write() << g_GIT_DESCRIPTION;
SimpleLogger().Write() << OSRM_VERSION;
return false;
}
+2 -2
View File
@@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ROUTED_OPTIONS_HPP
#define ROUTED_OPTIONS_HPP
#include "git_sha.hpp"
#include "version.hpp"
#include "ini_file.hpp"
#include "osrm_exception.hpp"
#include "simple_logger.hpp"
@@ -232,7 +232,7 @@ inline unsigned GenerateServerProgramOptions(const int argc,
if (option_variables.count("version"))
{
SimpleLogger().Write() << g_GIT_DESCRIPTION;
SimpleLogger().Write() << OSRM_VERSION;
return INIT_OK_DO_NOT_START_ENGINE;
}
+8 -4
View File
@@ -25,9 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GIT_SHA_HPP
#define GIT_SHA_HPP
#ifndef VERSION_HPP
#define VERSION_HPP
extern char g_GIT_DESCRIPTION[];
#define OSRM_VERSION_MAJOR "4"
#define OSRM_VERSION_MINOR "8"
#define OSRM_VERSION_PATCH "0"
#endif // GIT_SHA_HPP
#define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH
#endif // VERSION_HPP
+9 -3
View File
@@ -25,7 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "git_sha.hpp"
#ifndef VERSION_HPP
#define VERSION_HPP
#define GIT_DESCRIPTION "${GIT_DESCRIPTION}"
char g_GIT_DESCRIPTION[] = GIT_DESCRIPTION;
#define OSRM_VERSION_MAJOR "@OSRM_VERSION_MAJOR@"
#define OSRM_VERSION_MINOR "@OSRM_VERSION_MINOR@"
#define OSRM_VERSION_PATCH "@OSRM_VERSION_PATCH@"
#define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH
#endif // VERSION_HPP