Files
clio/src/main/impl/Build.cpp
2022-12-06 16:23:33 +00:00

61 lines
1.3 KiB
C++

#include <ripple/beast/core/SemanticVersion.h>
#include <boost/preprocessor/stringize.hpp>
#include <algorithm>
#include <main/Build.h>
#include <optional>
#include <stdexcept>
namespace Build {
//--------------------------------------------------------------------------
// The build version number. You must edit this for each release
// and follow the format described at http://semver.org/
//------------------------------------------------------------------------------
// clang-format off
char const* const versionString = "1.0.3"
// clang-format on
"+"
#ifdef CLIO_BUILD
CLIO_BUILD
#endif
#ifdef DEBUG
".DEBUG"
#ifdef SANITIZER
"."
#endif
#endif
#ifdef SANITIZER
BOOST_PP_STRINGIZE(SANITIZER)
#endif
#ifdef PKG
"-release"
#endif
//--------------------------------------------------------------------------
;
std::string const&
getClioVersionString()
{
static std::string const value = [] {
std::string const s = versionString;
beast::SemanticVersion v;
if (!v.parse(s) || v.print() != s)
throw std::runtime_error(s + ": Bad server version string");
return s;
}();
return value;
}
std::string const&
getClioFullVersionString()
{
static std::string const value = "clio-" + getClioVersionString();
return value;
}
} // namespace Build