diff --git a/CMakeLists.txt b/CMakeLists.txt index bc60fe48..97039b13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ if(NOT Boost_FOUND) endif() endif() +include (${CMAKE_MODULE_PATH}/boost.cmake) # -- make this work? set(python_ADDITIONAL_VERSIONS 2.7 2.6) find_package(PythonInterp) diff --git a/cmake/boost.cmake b/cmake/boost.cmake new file mode 100644 index 00000000..3d513deb --- /dev/null +++ b/cmake/boost.cmake @@ -0,0 +1,41 @@ +# Boost 1.62 has a bug that we've patched around, check if it is required +if (Boost_VERSION EQUAL 106200) + set (CMAKE_REQUIRED_INCLUDES ${BOOST_INCLUDEDIR} "${PROJECT_SOURCE_DIR}/include") + set (BOOST_REV_TEST " +#include +#include +#include +#include + +int main(int,char*[]) +{ + using namespace boost; + // Check const reverse_graph + { + typedef adjacency_list< vecS, vecS, bidirectionalS, + property, + property, + property + > AdjList; + typedef reverse_graph Graph; + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + } + return 0; +} +") + + CHECK_CXX_SOURCE_COMPILES("${BOOST_REV_TEST}" BOOST_REVGRAPH_OK) + + if (NOT BOOST_REVGRAPH_OK) + message(STATUS "trying patched") + CHECK_CXX_SOURCE_COMPILES(" +#include +${BOOST_REV_TEST}" BOOST_REVGRAPH_PATCH) + endif() + + if (NOT BOOST_REVGRAPH_OK AND NOT BOOST_REVGRAPH_PATCH) + message(FATAL_ERROR "Something is wrong with this copy of boost::reverse_graph") + endif() + + unset (CMAKE_REQUIRED_INCLUDES) +endif () # Boost 1.62.0 diff --git a/cmake/config.h.in b/cmake/config.h.in index d8430f22..c7b577c2 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -89,3 +89,5 @@ /* define if this is a release build. */ #cmakedefine RELEASE_BUILD +/* define if reverse_graph requires patch for boost 1.62.0 */ +#cmakedefine BOOST_REVGRAPH_PATCH diff --git a/include/boost-patched/graph/reverse_graph.hpp b/include/boost-patched/graph/reverse_graph.hpp index 07a11f9b..8f98a1d5 100644 --- a/include/boost-patched/graph/reverse_graph.hpp +++ b/include/boost-patched/graph/reverse_graph.hpp @@ -5,7 +5,7 @@ #include -#if (BOOST_VERSION == 106200) +#if defined(BOOST_REVGRAPH_PATCH) // Boost 1.62.0 does not implement degree() in reverse_graph which is required // by BidirectionalGraph, so add it.