Skip to content

Commit 9a2af18

Browse files
committed
core: add and expose printEigenVersion
1 parent 7945405 commit 9a2af18

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

include/eigenpy/version.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ namespace eigenpy {
1818
///
1919
std::string EIGENPY_DLLAPI printVersion(const std::string& delimiter = ".");
2020

21+
///
22+
/// \brief Returns the current version of Eigen3 as a string using
23+
/// the following standard:
24+
/// EIGEN_MINOR_VERSION.EIGEN_MINOR_VERSION.EIGEN_PATCH_VERSION
25+
///
26+
std::string EIGENPY_DLLAPI
27+
printEigenVersion(const std::string& delimiter = ".");
28+
2129
///
2230
/// \brief Checks if the current version of EigenPy is at least the version
2331
/// provided

python/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2014-2019, CNRS
3-
* Copyright 2018-2022, INRIA
3+
* Copyright 2018-2023, INRIA
44
*/
55

66
#include <boost/python/scope.hpp>
@@ -22,6 +22,7 @@ BOOST_PYTHON_MODULE(eigenpy_pywrap) {
2222
enableEigenPy();
2323

2424
bp::scope().attr("__version__") = eigenpy::printVersion();
25+
bp::scope().attr("__eigen_version__") = eigenpy::printEigenVersion();
2526
bp::scope().attr("__raw_version__") = bp::str(EIGENPY_VERSION);
2627
bp::def("checkVersionAtLeast", &eigenpy::checkVersionAtLeast,
2728
bp::args("major_version", "minor_version", "patch_version"),

src/version.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//
2-
// Copyright (c) 2019 INRIA
2+
// Copyright (c) 2019-2023 INRIA
33
//
44

55
#include "eigenpy/version.hpp"
6+
#include "eigenpy/config.hpp"
67

78
#include <sstream>
8-
9-
#include "eigenpy/config.hpp"
9+
#include <Eigen/Core>
1010

1111
namespace eigenpy {
1212

@@ -17,6 +17,13 @@ std::string printVersion(const std::string& delimiter) {
1717
return oss.str();
1818
}
1919

20+
std::string printEigenVersion(const std::string& delimiter) {
21+
std::ostringstream oss;
22+
oss << EIGEN_MAJOR_VERSION << delimiter << EIGEN_MINOR_VERSION << delimiter
23+
<< EIGEN_MINOR_VERSION;
24+
return oss.str();
25+
}
26+
2027
bool checkVersionAtLeast(unsigned int major_version, unsigned int minor_version,
2128
unsigned int patch_version) {
2229
return EIGENPY_VERSION_AT_LEAST(major_version, minor_version, patch_version);

0 commit comments

Comments
 (0)