version.cc 1.48 KB
Newer Older
1
2
3
4
5
6
//
// Copyright (c) 2019 CNRS
//

#include "hpp/fcl/config.hh"
#include <boost/python.hpp>
7
#include <boost/preprocessor/stringize.hpp>
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

namespace bp = boost::python;

inline bool checkVersionAtLeast(unsigned int major,
                                unsigned int minor,
                                unsigned int patch)
{
  return HPP_FCL_VERSION_AT_LEAST(major, minor, patch);
}

inline bool checkVersionAtMost(unsigned int major,
                               unsigned int minor,
                               unsigned int patch)
{
  return HPP_FCL_VERSION_AT_MOST(major, minor, patch);
}

void exposeVersion()
{
  // Define release numbers of the current hpp-fcl version.
28
29
30
  bp::scope().attr("__version__") = BOOST_PP_STRINGIZE(HPP_FCL_MAJOR_VERSION) "."
    BOOST_PP_STRINGIZE(HPP_FCL_MINOR_VERSION) "."
    BOOST_PP_STRINGIZE(HPP_FCL_PATCH_VERSION);
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  bp::scope().attr("HPP_FCL_MAJOR_VERSION") = HPP_FCL_MAJOR_VERSION;
  bp::scope().attr("HPP_FCL_MINOR_VERSION") = HPP_FCL_MINOR_VERSION;
  bp::scope().attr("HPP_FCL_PATCH_VERSION") = HPP_FCL_PATCH_VERSION;

  bp::def("checkVersionAtLeast",&checkVersionAtLeast,
          bp::args("major","minor","patch"),
          "Checks if the current version of hpp-fcl is at least"
          " the version provided by the input arguments.");

  bp::def("checkVersionAtMost",&checkVersionAtMost,
          bp::args("major","minor","patch"),
          "Checks if the current version of hpp-fcl is at most"
          " the version provided by the input arguments.");
}