From c572879bc90e098678c4a1a408ba43ea74ed8595 Mon Sep 17 00:00:00 2001 From: paugier Date: Thu, 5 Sep 2024 10:23:51 +0200 Subject: [PATCH] MPI detection: try --showme:compile/--showme:link and -compile_info/-link_info --- mesonbuild/dependencies/mpi.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mesonbuild/dependencies/mpi.py b/mesonbuild/dependencies/mpi.py index 246b31233..2d9e992f6 100644 --- a/mesonbuild/dependencies/mpi.py +++ b/mesonbuild/dependencies/mpi.py @@ -10,7 +10,7 @@ import re from ..environment import detect_cpu_family from ..mesonlib import Popen_safe -from .base import DependencyMethods, detect_compiler, SystemDependency +from .base import DependencyException, DependencyMethods, detect_compiler, SystemDependency from .configtool import ConfigToolDependency from .detect import packages from .factory import factory_methods @@ -108,9 +108,21 @@ class MPIConfigToolDependency(ConfigToolDependency): if not self.is_found: return - args = self.get_config_value(['-show'], 'link and compile args') - self.compile_args = self._filter_compile_args(args) - self.link_args = self._filter_link_args(args) + # --showme for OpenMPI, -compile_info/-link_info for MPICH and IntelMPI + for comp, link in [('--showme:compile', '--showme:link'), ('-compile_info', '-link_info'), ('-show', None)]: + try: + c_args = self.get_config_value([comp], 'compile_args') + l_args = self.get_config_value([link], 'link_args') if link is not None else c_args + except DependencyException: + continue + else: + break + else: + self.is_found = False + return + + self.compile_args = self._filter_compile_args(c_args) + self.link_args = self._filter_link_args(l_args) def _filter_compile_args(self, args: T.List[str]) -> T.List[str]: """