diff --git a/CMakeLists.txt b/CMakeLists.txt index cdba6a1..1bc0391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,12 +31,17 @@ find_package(NumPy REQUIRED) # set(Boost_USE_STATIC_LIBS ON) # set(Boost_USE_MULTITHREADED ON) # set(Boost_USE_STATIC_RUNTIME ON) -FIND_PACKAGE(Boost COMPONENTS python REQUIRED) +if(${PYTHON_VERSION_STRING} GREATER 3.0) + message(STATUS "Use Python3") + find_package(Boost COMPONENTS python3 REQUIRED) +else() + message(STATUS "Use Python2") + find_package(Boost COMPONENTS python REQUIRED) +endif() -message( STATUS "found boost:" - "\nINCLUDE: ${Boost_INCLUDE_DIRS}" - "\nLIB: ${Boost_LIBRARIES}" -) +message( STATUS "Paths of Boost:") +message( STATUS "Include : " ${Boost_INCLUDE_DIRS}) +message( STATUS "Libraries: " ${Boost_LIBRARIES}) # add_definitions( -DBOOST_ALL_NO_LIB ) # In some cases, you may need to explicitly specify that a dynamic Boost is used; if so use: diff --git a/libs/numpy/example/wrap.cpp b/libs/numpy/example/wrap.cpp index 06a8d55..5d2027e 100644 --- a/libs/numpy/example/wrap.cpp +++ b/libs/numpy/example/wrap.cpp @@ -111,8 +111,11 @@ BOOST_PYTHON_MODULE(example) { int main(int argc, char **argv) { // This line makes our module available to the embedded Python intepreter. - PyImport_AppendInittab("example", &initexample); - +# if PY_VERSION_HEX >= 0x03000000 + PyImport_AppendInittab("example", &PyInit_example); +# else + PyImport_AppendInittab("example", &initexample); +# endif // Initialize the Python runtime. Py_Initialize();