| 1 |
|
| 2 |
|
| 3 |
# - FindMPI4PY |
| 4 |
# Find mpi4py includes and library |
| 5 |
# This module defines: |
| 6 |
# MPI4PY_INCLUDE_DIR, where to find mpi4py.h, etc. |
| 7 |
# MPI4PY_FOUND |
| 8 |
|
| 9 |
# https://compacc.fnal.gov/projects/repositories/entry/synergia2/CMake/FindMPI4PY.cmake?rev=c147eafb60728606af4fe7b1b161a660df142e9a |
| 10 |
|
| 11 |
if(NOT MPI4PY_INCLUDE_DIR) |
| 12 |
execute_process(COMMAND |
| 13 |
"${PYTHON_EXECUTABLE}" "-c" "import mpi4py; print(mpi4py.get_include())" |
| 14 |
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR |
| 15 |
RESULT_VARIABLE MPI4PY_COMMAND_RESULT |
| 16 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 17 |
if(MPI4PY_COMMAND_RESULT) |
| 18 |
message("jfa: mpi4py not found") |
| 19 |
set(MPI4PY_FOUND FALSE) |
| 20 |
else(MPI4PY_COMMAND_RESULT) |
| 21 |
if (MPI4PY_INCLUDE_DIR MATCHES "Traceback") |
| 22 |
message("jfa: mpi4py matches traceback") |
| 23 |
## Did not successfully include MPI4PY |
| 24 |
set(MPI4PY_FOUND FALSE) |
| 25 |
else (MPI4PY_INCLUDE_DIR MATCHES "Traceback") |
| 26 |
## successful |
| 27 |
set(MPI4PY_FOUND TRUE) |
| 28 |
set(MPI4PY_INCLUDE_DIR ${MPI4PY_INCLUDE_DIR} CACHE STRING "mpi4py include path") |
| 29 |
endif (MPI4PY_INCLUDE_DIR MATCHES "Traceback") |
| 30 |
endif(MPI4PY_COMMAND_RESULT) |
| 31 |
else(NOT MPI4PY_INCLUDE_DIR) |
| 32 |
set(MPI4PY_FOUND TRUE) |
| 33 |
endif(NOT MPI4PY_INCLUDE_DIR) |
| 34 |
|
| 35 |
include(FindPackageHandleStandardArgs) |
| 36 |
find_package_handle_standard_args(MPI4PY DEFAULT_MSG MPI4PY_INCLUDE_DIR) |