From c4ebf751f46ab0f69293c4bf65132097cc64d0ce Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Thu, 22 Feb 2018 15:19:01 +0100 Subject: [PATCH] Use version label in cli --- src/storm/utility/storm-version.h | 35 +++++++++++++++++-------------- storm-version.cpp.in | 1 + 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/storm/utility/storm-version.h b/src/storm/utility/storm-version.h index e4d372cc7..72f047906 100644 --- a/src/storm/utility/storm-version.h +++ b/src/storm/utility/storm-version.h @@ -7,35 +7,38 @@ namespace storm { namespace utility { - + struct StormVersion { /// The major version of Storm. const static unsigned versionMajor; - + /// The minor version of Storm. const static unsigned versionMinor; - + /// The patch version of Storm. const static unsigned versionPatch; - + + /// The label version of Storm (might be empty). + const static std::string versionLabel; + /// Flag indicating if the version of Storm is a development version. const static bool versionDev; - + /// The short hash of the git commit this build is based on const static std::string gitRevisionHash; - + /// How many commits passed since the tag was last set. const static unsigned commitsAhead; - + /// 0 iff there no files were modified in the checkout, 1 otherwise. If none, no information about dirtyness is given. const static boost::optional dirty; - + /// The system which has compiled Storm. const static std::string systemName; - + /// The system version which has compiled Storm. const static std::string systemVersion; - + /// The compiler version that was used to build Storm. const static std::string cxxCompiler; @@ -45,18 +48,18 @@ namespace storm { static std::string shortVersionString() { std::stringstream sstream; sstream << versionMajor << "." << versionMinor << "." << versionPatch; + if (!versionLabel.empty()) { + sstream << "-" << versionLabel; + } if (versionDev) { sstream << " (dev)"; } return sstream.str(); } - + static std::string longVersionString() { std::stringstream sstream; - sstream << "Version " << versionMajor << "." << versionMinor << "." << versionPatch; - if (versionDev) { - sstream << " (dev)"; - } + sstream << "Version " << shortVersionString(); if (commitsAhead) { sstream << " (+ " << commitsAhead << " commits)"; } @@ -76,7 +79,7 @@ namespace storm { } return sstream.str(); } - + static std::string buildInfo() { std::stringstream sstream; sstream << "Compiled on " << systemName << " " << systemVersion << " using " << cxxCompiler << " with flags '" << cxxFlags << "'"; diff --git a/storm-version.cpp.in b/storm-version.cpp.in index c6c1acf71..9ff273d4b 100644 --- a/storm-version.cpp.in +++ b/storm-version.cpp.in @@ -8,6 +8,7 @@ namespace storm { const unsigned StormVersion::versionMajor = @STORM_VERSION_MAJOR@; const unsigned StormVersion::versionMinor = @STORM_VERSION_MINOR@; const unsigned StormVersion::versionPatch = @STORM_VERSION_DEV_PATCH@; + const std::string StormVersion::versionLabel = "@STORM_VERSION_LABEL@"; const bool StormVersion::versionDev = @STORM_VERSION_DEV@; const std::string StormVersion::gitRevisionHash = "@STORM_VERSION_GIT_HASH@"; const unsigned StormVersion::commitsAhead = @STORM_VERSION_COMMITS_AHEAD@;