Skip to content
Snippets Groups Projects
Commit aa97c122 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

python wrappers : remove LD_PRELOAD hack for openmpi

in rundgpy and replace it by a hack in gmshpy::__init__ so that gmshpy
can be load as a standard python module even if linked with openmpi
(compiled with dynamic modules)
standard module
parent 66da9de2
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,18 @@ endif(ENABLE_PYTHON_LIB_API) ...@@ -72,6 +72,18 @@ endif(ENABLE_PYTHON_LIB_API)
include(${SWIG_USE_FILE}) include(${SWIG_USE_FILE})
include_directories(${PYTHON_INCLUDE_PATH}) include_directories(${PYTHON_INCLUDE_PATH})
IF(HAVE_MPI)
# this hack is only required for openmpi compiled with dynamic modules
# unfortunately I do not know how to detect this situation => I always enable it
set(GMSH_PYTHON_MODULES_INCLUDE_CODE "import ctypes\n")
FOREACH (lib ${MPI_C_LIBRARIES})
IF (${lib} MATCHES ".*libmpi.*")
set(GMSH_PYTHON_MODULES_INCLUDE_CODE
"${GMSH_PYTHON_MODULES_INCLUDE_CODE}ctypes.CDLL(\"${lib}\", mode = ctypes.RTLD_GLOBAL)\n")
ENDIF (${lib} MATCHES ".*libmpi.*")
ENDFOREACH (lib)
ENDIF(HAVE_MPI)
foreach(module ${SWIG_MODULES}) foreach(module ${SWIG_MODULES})
set_source_files_properties(${module}.i PROPERTIES CPLUSPLUS ON) set_source_files_properties(${module}.i PROPERTIES CPLUSPLUS ON)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment