intel-oneapi-mkl: change logic for gfortran compatibility (#44242)

* [intel-oneapi-mkl]: change logic for gfortran compatibility

* review comments

Co-authored-by: Rocco Meli <r.meli@bluemail.ch>

* warn if fortran-rt and gcc are used without gfortran

* remove warning

---------

Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
This commit is contained in:
Robert Cohn 2024-05-29 17:02:28 -04:00 committed by GitHub
parent 2470fde5d9
commit 1184de8352
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,6 +111,8 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage):
expand=False,
)
variant("gfortran", default=False, description="Compatibility with GNU Fortran")
variant("shared", default=True, description="Builds shared library")
variant("ilp64", default=False, description="Build with ILP64 support")
variant(
@ -200,10 +202,16 @@ def _find_mkl_libs(self, shared):
if self.spec.satisfies("+cluster"):
libs.extend([self._xlp64_lib("libmkl_scalapack"), "libmkl_cdft_core"])
if self.spec.satisfies("%oneapi") or self.spec.satisfies("%intel"):
libs.append(self._xlp64_lib("libmkl_intel"))
else:
# Explicit variant for compatibility with gfortran, otherwise
# support intel fortran. Be aware that some dependencies may
# be using this logic and other dependencies might be using
# cmake for the library list and they have to be consistent.
# https://github.com/spack/spack/pull/43673 for discussion
if self.spec.satisfies("+gfortran"):
depends_on("fortran", type="build")
libs.append(self._xlp64_lib("libmkl_gf"))
else:
libs.append(self._xlp64_lib("libmkl_intel"))
if self.spec.satisfies("threads=tbb"):
libs.append("libmkl_tbb_thread")