Add a `MPI` property to the Gromacs::gmxapi CMake target.
Add "gmx_mpi_type" to gmxconfig.json
Refs #2961
VERSION_PATCH ${GMXAPI_PATCH}
RELEASE ${GMXAPI_RELEASE})
+
+if (GMX_LIB_MPI)
+ # GROMACS is built against an MPI library.
+ # Clarification should be possible with resolution of #3672.
+ set(_gmx_mpi_type "library")
+elseif(GMX_THREAD_MPI)
+ # GROMACS is built with its internal thread-MPI implementation.
+ set(_gmx_mpi_type "tmpi")
+else()
+ # GROMACS is built without MPI or thread-MPI.
+ set(_gmx_mpi_type "none")
+endif ()
+define_property(TARGET PROPERTY MPI
+ BRIEF_DOCS "MPI capability of the GROMACS library."
+ FULL_DOCS "Values of 'library', 'tmpi', or 'none' indicate the configure-time options of the GROMACS
+ library build.")
+set_target_properties(gmxapi PROPERTIES
+ MPI ${_gmx_mpi_type})
+unset(_gmx_mpi_type)
+
##########################
# Define public interface.
#
include(CMakePackageConfigHelpers)
+get_target_property(_mpi Gromacs::gmxapi MPI)
configure_package_config_file(
cmake/gmxapi-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/cmake/gmxapi-config.cmake"
INSTALL_DESTINATION share/cmake/gmxapi/
)
+unset(_mpi)
get_target_property(GMXAPI_RELEASE gmxapi RELEASE)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/cmake/gmxapi-config-version.cmake
# https://cmake.org/cmake/help/v3.4/module/CMakePackageConfigHelpers.html#command:configure_package_config_file
include("${CMAKE_CURRENT_LIST_DIR}/gmxapi.cmake")
check_required_components(gmxapi)
+set_property(TARGET Gromacs::gmxapi PROPERTY MPI "@_mpi@")
HINTS "$ENV{GROMACS_DIR}"
)
endif()
+
+# Get details of GROMACS installation needed by the Python package at run time.
+
+# Get the MPI capability.
+get_target_property(_gmx_mpi Gromacs::gmxapi MPI)
+if (${_gmx_mpi} STREQUAL "library")
+ set(_gmx_mpi_type "\"library\"")
+elseif(${_gmx_mpi} STREQUAL "tmpi")
+ set(_gmx_mpi_type "\"tmpi\"")
+elseif(${_gmx_mpi} STREQUAL "none")
+ set(_gmx_mpi_type "null")
+else()
+ message(FATAL_ERROR "Unrecognized gmxapi MPI value: ${_gmx_mpi}")
+endif ()
+unset(_gmx_mpi)
+# Get the path of the command line entry point and binary install directory.
if (NOT TARGET Gromacs::gmx)
message(FATAL_ERROR "GROMACS command line tool not found.")
endif ()
configure_file(gmxapi/gmxconfig.json.in ${GMXAPI_PYTHON_STAGING_DIR}/gmxapi/gmxconfig.json)
unset(_gmx_executable)
unset(_gmx_bindir)
+unset(_gmx_mpi_type)
# scikit-build sets SKBUILD when running Python packaging tools through setup.py
# (e.g. with pip)
{
"gmx_executable": "@_gmx_executable@",
- "gmx_bindir": "@_gmx_bindir@"
+ "gmx_bindir": "@_gmx_bindir@",
+ "gmx_mpi_type": @_gmx_mpi_type@
}