-
Notifications
You must be signed in to change notification settings - Fork 62
/
FindMPI4PY.cmake
43 lines (38 loc) · 1.54 KB
/
FindMPI4PY.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# - FindMPI4PY
# Find mpi4py includes and library
# This module defines:
# MPI4PY_INCLUDE_DIR, where to find mpi4py.h, etc.
# MPI4PY_FOUND
# MPI4PY_VENDOR
# https://compacc.fnal.gov/projects/repositories/entry/synergia2/CMake/FindMPI4PY.cmake?rev=c147eafb60728606af4fe7b1b161a660df142e9a
if(NOT MPI4PY_INCLUDE_DIR)
execute_process(COMMAND
"${Python_EXECUTABLE}" "-c" "import mpi4py; print(mpi4py.get_include())"
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR
RESULT_VARIABLE MPI4PY_COMMAND_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MPI4PY_COMMAND_RESULT)
message("jfa: mpi4py not found")
set(MPI4PY_FOUND FALSE)
else(MPI4PY_COMMAND_RESULT)
if (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
message("jfa: mpi4py matches traceback")
## Did not successfully include MPI4PY
set(MPI4PY_FOUND FALSE)
else (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
## successful
set(MPI4PY_FOUND TRUE)
set(MPI4PY_INCLUDE_DIR ${MPI4PY_INCLUDE_DIR} CACHE STRING "mpi4py include path")
endif (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
endif(MPI4PY_COMMAND_RESULT)
else(NOT MPI4PY_INCLUDE_DIR)
set(MPI4PY_FOUND TRUE)
endif(NOT MPI4PY_INCLUDE_DIR)
if(MPI4PY_FOUND)
execute_process(COMMAND
"${Python_EXECUTABLE}" "-c" "from mpi4py import MPI; print(MPI.get_vendor())"
OUTPUT_VARIABLE MPI4PY_VENDOR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPI4PY DEFAULT_MSG MPI4PY_INCLUDE_DIR)