Commit 322a4f4b authored by Tiago Peixoto's avatar Tiago Peixoto

Make boost::coroutine optional

This is essentially because of a Debian bug, where no boost::coroutine
shared libraries are available.
parent a875e876
Pipeline #57 failed with stage
......@@ -217,7 +217,7 @@ if test "$BOOST_REGEX_LIB" = ""; then
fi
AX_BOOST_COROUTINE
if test "$BOOST_COROUTINE_LIB" = ""; then
AC_MSG_ERROR([No usable boost::coroutine found])
AC_MSG_WARN([No usable boost::coroutine found! Some functionality will be disabled in the library.])
fi
AX_BOOST_GRAPH
if test "$BOOST_GRAPH_LIB" = ""; then
......
......@@ -153,6 +153,7 @@ boost::python::object astar_search_generator(GraphInterface& g,
python::object inf,
python::object h)
{
#ifdef HAVE_BOOST_COROUTINE
auto dispatch = [&](auto& yield)
{
AStarGeneratorVisitor vis(g, yield);
......@@ -164,6 +165,9 @@ boost::python::object astar_search_generator(GraphInterface& g,
writable_vertex_properties())(dist_map);
};
return boost::python::object(AStarGenerator(dispatch));
#else
throw GraphException("This functionality is not available because boost::coroutine was not found at compile-time")
#endif
}
boost::python::object astar_search_generator_fast(GraphInterface& g,
......
......@@ -164,6 +164,7 @@ private:
boost::python::object bfs_search_generator(GraphInterface& g, size_t s)
{
#ifdef HAVE_BOOST_COROUTINE
auto dispatch = [&](auto& yield)
{
BFSGeneratorVisitor vis(g, yield);
......@@ -171,6 +172,9 @@ boost::python::object bfs_search_generator(GraphInterface& g, size_t s)
(g, std::bind(do_bfs(), placeholders::_1, s, vis))();
};
return boost::python::object(BFSGenerator(dispatch));
#else
throw GraphException("This functionality is not available because boost::coroutine was not found at compile-time")
#endif
}
void export_bfs()
......
......@@ -154,6 +154,7 @@ private:
boost::python::object dfs_search_generator(GraphInterface& g, size_t s)
{
#ifdef HAVE_BOOST_COROUTINE
auto dispatch = [&](auto& yield)
{
DFSGeneratorVisitor vis(g, yield);
......@@ -162,6 +163,9 @@ boost::python::object dfs_search_generator(GraphInterface& g, size_t s)
g.get_vertex_index(), s, vis))();
};
return boost::python::object(DFSGenerator(dispatch));
#else
throw GraphException("This functionality is not available because boost::coroutine was not found at compile-time")
#endif
}
void export_dfs()
......
......@@ -231,6 +231,7 @@ boost::python::object dijkstra_search_generator(GraphInterface& g,
python::object zero,
python::object inf)
{
#ifdef HAVE_BOOST_COROUTINE
auto dispatch = [&](auto& yield)
{
DJKGeneratorVisitor vis(g, yield);
......@@ -242,6 +243,9 @@ boost::python::object dijkstra_search_generator(GraphInterface& g,
writable_vertex_properties())(dist_map);
};
return boost::python::object(DJKGenerator(dispatch));
#else
throw GraphException("This functionality is not available because boost::coroutine was not found at compile-time")
#endif
}
boost::python::object dijkstra_search_generator_fast(GraphInterface& g,
......@@ -250,6 +254,7 @@ boost::python::object dijkstra_search_generator_fast(GraphInterface& g,
boost::any weight,
python::object zero, python::object inf)
{
#ifdef HAVE_BOOST_COROUTINE
auto dispatch = [&](auto& yield)
{
DJKGeneratorVisitor vis(g, yield);
......@@ -261,6 +266,9 @@ boost::python::object dijkstra_search_generator_fast(GraphInterface& g,
edge_scalar_properties())(dist_map, weight);
};
return boost::python::object(DJKGenerator(dispatch));
#else
throw GraphException("This functionality is not available because boost::coroutine was not found at compile-time")
#endif
}
void export_dijkstra()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment