File tree Expand file tree Collapse file tree
bindings/python/boost/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ function(mgis_python_module name output_name)
2020 # include directories
2121 target_include_directories (${module}
2222 SYSTEM
23- PRIVATE "${PROJECT_SOURCE_DIR} /bindings/python/include"
23+ PRIVATE "${PROJECT_SOURCE_DIR} /bindings/python/boost/ include"
2424 PRIVATE "${Boost_INCLUDE_DIRS} " )
2525 # Link flags for python modules.
2626 #
@@ -37,7 +37,7 @@ function(mgis_python_module name output_name)
3737 target_link_libraries (${module}
3838 PRIVATE
3939 MFrontGenericInterface
40- ${CONAN_LIBS} Python::NumPy Python::Module )
40+ ${CONAN_LIBS} Python::Python Python::NumPy )
4141 else (APPLE )
4242 target_link_libraries (${module}
4343 PRIVATE
@@ -57,7 +57,8 @@ function(mgis_python_module name output_name)
5757 target_link_libraries (${module}
5858 PRIVATE
5959 MFrontGenericInterface
60- ${Boost_NUMPY_LIBRARY} ${Boost_PYTHON_LIBRARY} Python::NumPy Python::Module )
60+ ${Boost_NUMPY_LIBRARY} ${Boost_PYTHON_LIBRARY}
61+ Python::Python Python::NumPy )
6162 endif (disable_python_library_linking )
6263 endif (MGIS_USES_CONAN )
6364 # installation
Original file line number Diff line number Diff line change 1313 */
1414
1515#include < numpy/ndarrayobject.h>
16- #include < boost/python/numpy.hpp>
16+ // #include <boost/python/numpy.hpp>
1717#include " MGIS/Raise.hxx"
1818#include " MGIS/Python/NumPySupport.hxx"
1919
2020namespace mgis ::python {
2121
22- void initializeNumPy () {
23- Py_Initialize ();
24- boost::python::numpy::initialize ();
25- } // end of initializeNumPy
22+ #if PY_MAJOR_VERSION == 2
23+ static void wrapInitializeNumPy () { import_array (); }
24+ #else
25+ static void * wrapInitializeNumPy () {
26+ import_array ();
27+ return nullptr ;
28+ }
29+ #endif
30+
31+ void initializeNumPy () { wrapInitializeNumPy (); } // end of initializeNumPy
32+
33+ // void initializeNumPy() { wrapInitializeNumPy(); } // end of initializeNumPy void initializeNumPy() {
34+ // boost::python::numpy::initialize();
35+ // } // end of initializeNumPy
2636
2737 boost::python::object wrapInNumPyArray (std::span<double >& v) {
2838 npy_intp dims[1 ] = {static_cast <npy_intp>(v.size ())};
You can’t perform that action at this time.
0 commit comments