Skip to content
Snippets Groups Projects
MantidVersion.cpp.in 1.35 KiB
Newer Older
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/MantidVersion.h"

#include <sstream>
#include <boost/lexical_cast.hpp>

namespace Mantid
{
namespace 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@";
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@";
}

const char* MantidVersion::mainDOI()
{
  return "http://dx.doi.org/10.5286/Software/Mantid";
}

std::string MantidVersion::releaseDOI()
{
  int patchVersion;
  try
  {
    patchVersion = boost::lexical_cast<int>(@MtdVersion_WC_LAST_CHANGED_REV@);
  }
  catch(boost::bad_lexical_cast &)
  {
    patchVersion = 0;
  }

  std::stringstream doi;
  doi << mainDOI() << "@VERSION_MAJOR@.@VERSION_MINOR@";

  if( patchVersion != 0 )
    doi << "." << patchVersion;

  return doi.str();
}

} // namespace Kernel
} // namespace Mantid