Skip to content

Commit

Permalink
use boost::timer::progress_display if available
Browse files Browse the repository at this point in the history
check for header to stay compatible with ubuntu 20.04.

Support boost >= 1.83

Slightly ugly due to the double alias, but boost::timer was a class
before 1.72, so using `boost::timer::progress_display` in the code
breaks with older versions.

cherry-pick of #3547 from MoveIt1
  • Loading branch information
v4hn authored and rhaschke committed Apr 15, 2024
1 parent bec810c commit 2bc2882
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions moveit_ros/benchmarks/src/BenchmarkExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@
#include <tf2_eigen/tf2_eigen.hpp>
#include <moveit/utils/logger.hpp>

// TODO(henningkayser): Switch to boost/timer/progress_display.hpp with Boost 1.72
// boost/progress.hpp is deprecated and will be replaced by boost/timer/progress_display.hpp in Boost 1.72.
// Until then we need to suppress the deprecation warning.
#define BOOST_ALLOW_DEPRECATED_HEADERS
#include <boost/regex.hpp>

#if __has_include(<boost/timer/progress_display.hpp>)
#include <boost/timer/progress_display.hpp>
using boost_progress_display = boost::timer::progress_display;
#else
// boost < 1.72
#define BOOST_TIMER_ENABLE_DEPRECATED 1
#include <boost/progress.hpp>
#undef BOOST_ALLOW_DEPRECATED_HEADERS
#undef BOOST_TIMER_ENABLE_DEPRECATED
using boost_progress_display = boost::progress_display;
#endif

#include <boost/math/constants/constants.hpp>
#include <boost/filesystem.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <math.h>
#include <limits>
Expand Down Expand Up @@ -776,7 +784,7 @@ void BenchmarkExecutor::runBenchmark(moveit_msgs::msg::MotionPlanRequest request
}
num_planners += options.parallel_planning_pipelines.size();

boost::progress_display progress(num_planners * options.runs, std::cout);
boost_progress_display progress(num_planners * options.runs, std::cout);

// Iterate through all planning pipelines
auto planning_pipelines = moveit_cpp_->getPlanningPipelines();
Expand Down

0 comments on commit 2bc2882

Please sign in to comment.