Skip to content
Snippets Groups Projects
Verified Commit 33713e86 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core/version: add version to the module

parent 72930d04
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,7 @@ SET(${PROJECT_NAME}_HEADERS ...@@ -106,6 +106,7 @@ SET(${PROJECT_NAME}_HEADERS
include/eigenpy/stride.hpp include/eigenpy/stride.hpp
include/eigenpy/ref.hpp include/eigenpy/ref.hpp
include/eigenpy/details/rvalue_from_python_data.hpp include/eigenpy/details/rvalue_from_python_data.hpp
include/eigenpy/version.hpp
) )
LIST(APPEND ${PROJECT_NAME}_HEADERS LIST(APPEND ${PROJECT_NAME}_HEADERS
...@@ -133,6 +134,7 @@ SET(${PROJECT_NAME}_SOURCES ...@@ -133,6 +134,7 @@ SET(${PROJECT_NAME}_SOURCES
src/angle-axis.cpp src/angle-axis.cpp
src/quaternion.cpp src/quaternion.cpp
src/geometry-conversion.cpp src/geometry-conversion.cpp
src/version.cpp
) )
ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS}) ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef __eigenpy_fwd_hpp__ #ifndef __eigenpy_fwd_hpp__
#define __eigenpy_fwd_hpp__ #define __eigenpy_fwd_hpp__
#include "eigenpy/config.hpp"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <Eigen/Core> #include <Eigen/Core>
......
//
// Copyright (c) 2019 INRIA
//
#ifndef __eigenpy_version_hpp__
#define __eigenpy_version_hpp__
#include "eigenpy/config.hpp"
#include <string>
namespace eigenpy
{
///
/// \brief Returns the current version of EigenPy as a string using
/// the following standard:
/// EIGENPY_MINOR_VERSION.EIGENPY_MINOR_VERSION.EIGENPY_PATCH_VERSION
///
std::string printVersion(const std::string & delimiter = ".");
///
/// \brief Checks if the current version of EigenPy is at least the version provided
/// by the input arguments.
///
/// \param[in] major_version Major version to check.
/// \param[in] minor_version Minor version to check.
/// \param[in] patch_version Patch version to check.
///
/// \returns true if the current version of EigenPy is greater than the version provided
/// by the input arguments.
///
bool checkVersionAtLeast(unsigned int major_version,
unsigned int minor_version,
unsigned int patch_version);
}
#endif // __eigenpy_version_hpp__
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include "eigenpy/eigenpy.hpp" #include "eigenpy/eigenpy.hpp"
#include "eigenpy/version.hpp"
namespace eigenpy namespace eigenpy
{ {
...@@ -12,6 +13,13 @@ namespace eigenpy ...@@ -12,6 +13,13 @@ namespace eigenpy
void enableEigenPy() void enableEigenPy()
{ {
using namespace Eigen; using namespace Eigen;
bp::scope().attr("__version__") = eigenpy::printVersion();
bp::scope().attr("__raw_version__") = bp::str(EIGENPY_VERSION);
bp::def("checkVersionAtLeast",&eigenpy::checkVersionAtLeast,
bp::args("major_version","minor_version","patch_version"),
"Checks if the current version of EigenPy is at least the version provided by the input arguments.");
Exception::registerException(); Exception::registerException();
bp::def("setNumpyType",&NumpyType::setNumpyType, bp::def("setNumpyType",&NumpyType::setNumpyType,
......
//
// Copyright (c) 2019 INRIA
//
#include "eigenpy/config.hpp"
#include "eigenpy/version.hpp"
#include <sstream>
namespace eigenpy
{
std::string printVersion(const std::string & delimiter)
{
std::ostringstream oss;
oss
<< EIGENPY_MAJOR_VERSION << delimiter
<< EIGENPY_MINOR_VERSION << delimiter
<< EIGENPY_PATCH_VERSION;
return oss.str();
}
bool checkVersionAtLeast(unsigned int major_version,
unsigned int minor_version,
unsigned int patch_version)
{
return EIGENPY_VERSION_AT_LEAST(major_version,minor_version,patch_version);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment