forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MantidVersion.cpp.in
112 lines (87 loc) · 3.63 KB
/
MantidVersion.cpp.in
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
@AUTO_GENERATE_WARNING@
/********** Source = MantidVersion.cpp.in *****************************************************/
#include "MantidKernel/MantidVersion.h"
#include <sstream>
namespace Mantid::Kernel {
const char* MantidVersion::version()
{
// The major and minor version numbers are specified in Build/CMake/VersionNumber.cmake
// The patch number is the number of commits since the most recent tag of the repository
return "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@@VERSION_TWEAK@";
}
const char* MantidVersion::versionShort()
{
// The major and minor version numbers are specified in Build/CMake/VersionNumber.cmake
return "@VERSION_MAJOR@.@VERSION_MINOR@";
}
const MantidVersion::VersionInfo MantidVersion::versionInfo() {
return {"@VERSION_MAJOR@", "@VERSION_MINOR@", "@VERSION_PATCH@@VERSION_TWEAK@"};
}
std::string MantidVersion::releaseNotes()
{
const std::string STEM = "qthelp://org.mantidproject/doc/release/v";
const std::string END = "/index.html";
// Cast here in those cases where patch number is of the form 20131022.1356.
const unsigned int patchVersion = static_cast<unsigned int>(@VERSION_PATCH@);
// For major/minor/patch releases we point users to a specific release-notes, for
// dev versions we point to the next main release notes. A simple way to see whether or not
// we're currently in a dev version is to check if the patch version is larger than
// some arbitrarily low value.
// for now the code assumes that the next main release version number will be one minor version higher
std::stringstream versionLabel;
if ( patchVersion < 100 ) {
versionLabel << versionShort();
versionLabel << "." << patchVersion;
}
else {
const unsigned int minorVersion = static_cast<unsigned int>(@VERSION_MINOR@);
versionLabel << "@VERSION_MAJOR@." << minorVersion + 1 << "." << "0";
}
std::stringstream url;
url << STEM << versionLabel.str() << END;
return url.str();
}
const char* MantidVersion::revision()
{
return "@MtdVersion_WC_LAST_CHANGED_SHA@";
}
const char* MantidVersion::revisionFull()
{
return "@MtdVersion_WC_LAST_CHANGED_SHA_LONG@";
}
const char* MantidVersion::releaseDate()
{
return "@MtdVersion_WC_LAST_CHANGED_DATE@";
}
std::string MantidVersion::doi()
{
const std::string MAIN = "http://dx.doi.org/10.5286/Software/Mantid";
// Cast here in those cases where patch number is of the form 20131022.1356.
const unsigned int patchVersion = static_cast<unsigned int>(@VERSION_PATCH@);
// For major/minor/patch releases we point users to a specific release-notes DOI, for
// dev versions we just point to the main DOI. A simple way to see whether or not
// we're currently in a dev version is to check if the patch version is larger than
// some arbitrarily low value.
if( patchVersion > 100 )
return MAIN;
std::stringstream doi;
doi << MAIN << @VERSION_MAJOR@ << "." << @VERSION_MINOR@;
// Keep to the convention where we write a version number like "3.0.0" as "3.0".
if( patchVersion != 0 )
doi << "." << patchVersion;
return doi.str();
}
std::string MantidVersion::paperCitation()
{
return "http://dx.doi.org/10.1016/j.nima.2014.07.029";
}
} // namespace Mantid::Kernel