From 49a0601c142d535afe5bc722593535bf66408b2d Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Tue, 15 Sep 2015 16:39:10 +0200 Subject: Add workaround for Boost.Python compile errors when using version 1.59.0 --- CMakeLists.txt | 26 ++++++++++++++++++++++++++ src/system.hh.in | 12 ++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2516b530..96d4d663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,32 @@ endif() cmake_pop_check_state() +# Check if fix for https://github.com/boostorg/python/issues/39 is needed +if (HAVE_BOOST_PYTHON) +cmake_push_check_state() + +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${Boost_INCLUDE_DIRS}) +set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} ${PROFILE_LIBS}) + +check_cxx_source_runs(" +#include + +struct X { int y; }; + +int main() +{ + boost::python::make_setter(&X::y); +}" BOOST_MAKE_SETTER_RUNS) + +if (BOOST_MAKE_SETTER_RUNS) + set(HAVE_BOOST_159_ISSUE_39 0) +else() + set(HAVE_BOOST_159_ISSUE_39 1) +endif() + +cmake_pop_check_state() +endif() + ######################################################################## include_directories(${CMAKE_INCLUDE_PATH}) diff --git a/src/system.hh.in b/src/system.hh.in index 8de27ad6..cd7b8c2b 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -71,6 +71,7 @@ #define HAVE_BOOST_PYTHON @HAVE_BOOST_PYTHON@ #define HAVE_BOOST_REGEX_UNICODE @HAVE_BOOST_REGEX_UNICODE@ +#define HAVE_BOOST_159_ISSUE_39 @HAVE_BOOST_159_ISSUE_39@ #define DEBUG_MODE @DEBUG_MODE@ #define NO_ASSERTS @NO_ASSERTS@ @@ -253,6 +254,17 @@ typedef std::ostream::pos_type ostream_pos_type; #include +#if BOOST_VERSION == 105900 && HAVE_BOOST_159_ISSUE_39 +// Fix for https://github.com/boostorg/python/issues/39 +namespace boost { namespace python { +template +inline object make_setter(D const& x) +{ + return detail::make_setter(x, default_call_policies(), is_member_pointer(), 0); +} +}} +#endif + #endif // HAVE_BOOST_PYTHON #endif // _SYSTEM_HH -- cgit v1.2.3