IF(MEDCOUPLING_SWIG4_COMPAT)
LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT")
ENDIF()
+
+ # Possibility to specify a mpi4py installation
+ SET(MEDCOUPLING_MPI4PY_DIR "" CACHE PATH "Path to the mpi4py installation")
+ IF(MEDCOUPLING_MPI4PY_DIR)
+ MESSAGE(STATUS "Using mpi4py directory: ${MEDCOUPLING_MPI4PY_DIR}")
+ SET(MEDCOUPLING_MPI4PY_INCLUDE_DIR "${MEDCOUPLING_MPI4PY_DIR}/include")
+ SET(MEDCOUPLING_MPI4PY_I_FILE "${MEDCOUPLING_MPI4PY_DIR}/include/mpi4py/mpi4py.i")
+ ENDIF()
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
IF(MEDCOUPLING_BUILD_DOC)
SALOME_LOG_OPTIONAL_PACKAGE(Sphinx MEDCOUPLING_BUILD_DOC)
ENDIF(MEDCOUPLING_BUILD_DOC)
+
# Detection report
SALOME_PACKAGE_REPORT_AND_CHECK()
SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
IF(MEDCOUPLING_USE_64BIT_IDS)
STRING(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
-ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+ENDIF()
SET (MEDCoupling_SWIG_DPYS_FILES
MEDCouplingCommon.i
IF(MEDCOUPLING_USE_64BIT_IDS)
STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+IF(MEDCOUPLING_MPI4PY_DIR)
+ INCLUDE_DIRECTORIES(${MEDCOUPLING_MPI4PY_INCLUDE_DIR})
+ STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_MPI4PY_I_FILE=${MEDCOUPLING_MPI4PY_I_FILE}")
+ENDIF()
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_DIRS}
%template() std::set<int>;
+// Include mpi4py typemap if present:
+#ifdef MEDCOUPLING_MPI4PY_I_FILE
+%include MEDCOUPLING_MPI4PY_I_FILE
+%mpi4py_typemap(Comm, MPI_Comm);
+#endif
+
%{
#include "CommInterface.hxx"
#include "ProcessorGroup.hxx"
IF(MEDCOUPLING_USE_64BIT_IDS)
STRING(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+IF(MEDCOUPLING_MPI4PY_DIR)
+ INCLUDE_DIRECTORIES(${MEDCOUPLING_MPI4PY_INCLUDE_DIR})
+ STRING(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS ";-DMEDCOUPLING_MPI4PY_I_FILE=${MEDCOUPLING_MPI4PY_I_FILE}")
+ENDIF()
SET(medcoupling_SWIG_DPYS_FILES medcoupling.i)