-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.h
76 lines (69 loc) · 2.25 KB
/
version.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef VERSION_H_
#define VERSION_H_
#include <string>
#include <sstream>
struct Version {
/// The major version of ZeusSqm
const static unsigned versionMajor;
/// The minor version of ZeusSqm
const static unsigned versionMinor;
/// The patch version of ZeusSqm
const static unsigned versionPatch;
/// The short hash of the git commit this build is bases on
const static std::string gitRevisionHash;
/// How many commits passed since the last tag was set
const static unsigned commitsAhead;
/// 0 iff no files were modified in the checkout, 1 else
const static unsigned dirty;
/// The system which has compiled ZeusSqm
const static std::string systemName;
/// The size of a pointer of the system that has compiled ZeusSqm
const static std::string systemPtrSize;
/// The system version which has compiled ZeusSqm
const static std::string systemVersion;
/// The build type that was used to build ZeusSqm
const static std::string buildType;
/// The compiler version that was used to build ZeusSqm
const static std::string cxxCompiler;
static std::string versionWithTagString() {
std::stringstream sstream;
sstream << versionMajor << "." << versionMinor << "." << versionPatch;
if (commitsAhead != 0) {
sstream << "+" << commitsAhead;
}
sstream << "-" << gitRevisionHash;
if (dirty == 1) {
sstream << "-DIRTY";
}
return sstream.str();
}
static std::string shortVersionString() {
std::stringstream sstream;
sstream << "ZeusSqm " << versionMajor << "." << versionMinor << "." << versionPatch;
return sstream.str();
}
static std::string longVersionString() {
std::stringstream sstream;
sstream << "Version: " << versionMajor << "." << versionMinor << "." << versionPatch;
if (commitsAhead != 0) {
sstream << " (+" << commitsAhead << " commits)";
}
sstream << " build from revision " << gitRevisionHash;
if (dirty == 1) {
sstream << " (DIRTY)";
}
sstream << ".";
return sstream.str();
}
static std::string buildInfo() {
std::stringstream sstream;
sstream << "Compiled on " << systemName << " " << systemVersion << " ";
sstream << "using compiler version " << cxxCompiler;
if (buildType != "") {
sstream << " with " << buildType << " flags";
}
sstream << ".";
return sstream.str();
}
};
#endif // VERSION_H_