hdf5 package: fix wrapper handling on Windows(#36265)

* msmpi has no wrappers so don't set MPI_CXX_COMPILER etc. for that
  MPI implementation
* hdf5 on Windows does not have h5cc etc., so do not try to filter
  them on Windows
This commit is contained in:
John W. Parent 2023-04-04 14:40:30 -04:00 committed by GitHub
parent 354d498971
commit 44306d3492
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,7 +205,7 @@ class Hdf5(CMakePackage):
# The compiler wrappers (h5cc, h5fc, etc.) run 'pkg-config'.
# Skip this on Windows since pkgconfig is autotools
for plat in ["cray", "darwin", "linux"]:
depends_on("pkgconfig", when="platform=%s" % plat, type="run")
depends_on("pkgconfig", when=f"platform={plat}", type="run")
conflicts("+mpi", "^mpich@4.0:4.0.3")
conflicts("api=v116", when="@1.6:1.14", msg="v116 is not compatible with this release")
@ -343,9 +343,19 @@ def patch(self):
# The parallel compiler wrappers (i.e. h5pcc, h5pfc, etc.) reference MPI
# compiler wrappers and do not need to be changed.
filter_compiler_wrappers(
"h5cc", "h5hlcc", "h5fc", "h5hlfc", "h5c++", "h5hlc++", relative_root="bin"
)
# These do not exist on Windows.
# Enable only for supported target platforms.
for spack_spec_target_platform in ["linux", "darwin", "cray"]:
filter_compiler_wrappers(
"h5cc",
"h5hlcc",
"h5fc",
"h5hlfc",
"h5c++",
"h5hlc++",
relative_root="bin",
when=f"platform={spack_spec_target_platform}",
)
def url_for_version(self, version):
url = (
@ -580,7 +590,10 @@ def cmake_args(self):
if api != "default":
args.append(self.define("DEFAULT_API_VERSION", api))
if "+mpi" in spec:
# MSMPI does not provide compiler wrappers
# and pointing these variables at the MSVC compilers
# breaks CMake's mpi detection for MSMPI.
if "+mpi" in spec and "msmpi" not in spec:
args.extend(
[
"-DMPI_CXX_COMPILER:PATH=%s" % spec["mpi"].mpicxx,