From 0f1898c82a92c45af9e7d70752ba4158b4b3fe0f Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Fri, 3 Nov 2023 14:23:49 +0100 Subject: [PATCH] xdmf3: fix compilation with hdf5@1.10 and above (#37551) --- .../packages/xdmf3/fix_hdf5_hid_t.diff | 40 +++++++++++++++++++ .../repos/builtin/packages/xdmf3/package.py | 8 ++-- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 var/spack/repos/builtin/packages/xdmf3/fix_hdf5_hid_t.diff diff --git a/var/spack/repos/builtin/packages/xdmf3/fix_hdf5_hid_t.diff b/var/spack/repos/builtin/packages/xdmf3/fix_hdf5_hid_t.diff new file mode 100644 index 0000000000..8323ddda26 --- /dev/null +++ b/var/spack/repos/builtin/packages/xdmf3/fix_hdf5_hid_t.diff @@ -0,0 +1,40 @@ +diff --git a/core/XdmfHDF5Controller.hpp b/core/XdmfHDF5Controller.hpp +index c5c15d0a..496cc80d 100644 +--- a/core/XdmfHDF5Controller.hpp ++++ b/core/XdmfHDF5Controller.hpp +@@ -27,13 +27,14 @@ + // C Compatible Includes + #include "XdmfCore.hpp" + #include "XdmfHeavyDataController.hpp" ++#include + + // So that hdf5 does not need to be included in the header files + // It would add a dependancy to programs that use Xdmf + #ifndef _H5Ipublic_H + #ifndef XDMF_HID_T + #define XDMF_HID_T +- typedef int hid_t; ++ typedef int64_t hid_t; + #endif + #endif + +diff --git a/core/XdmfHDF5Writer.hpp b/core/XdmfHDF5Writer.hpp +index cfbec6f4..f83aa0de 100644 +--- a/core/XdmfHDF5Writer.hpp ++++ b/core/XdmfHDF5Writer.hpp +@@ -28,13 +28,14 @@ + #include "XdmfCore.hpp" + #include "XdmfHeavyDataWriter.hpp" + #include "XdmfHeavyDataController.hpp" ++#include + + // So that hdf5 does not need to be included in the header files + // It would add a dependancy to programs that use Xdmf + #ifndef _H5Ipublic_H + #ifndef XDMF_HID_T + #define XDMF_HID_T +- typedef int hid_t; ++ typedef int64_t hid_t; + #endif + #endif + diff --git a/var/spack/repos/builtin/packages/xdmf3/package.py b/var/spack/repos/builtin/packages/xdmf3/package.py index 8a84aa27f1..ba54eed841 100644 --- a/var/spack/repos/builtin/packages/xdmf3/package.py +++ b/var/spack/repos/builtin/packages/xdmf3/package.py @@ -30,8 +30,10 @@ class Xdmf3(CMakePackage): # See https://github.com/spack/spack/pull/22303 for reference depends_on(Boost.with_default_variants) depends_on("mpi", when="+mpi") - depends_on("hdf5+mpi", when="+mpi") - depends_on("hdf5~mpi", when="~mpi") + depends_on("hdf5@1.10:+mpi", when="+mpi") + depends_on("hdf5@1.10:~mpi", when="~mpi") + # motivated by discussion in https://gitlab.kitware.com/xdmf/xdmf/-/issues/28 + patch("fix_hdf5_hid_t.diff") def cmake_args(self): """Populate cmake arguments for XDMF.""" @@ -42,7 +44,7 @@ def cmake_args(self): "-DXDMF_BUILD_UTILS=ON", "-DXDMF_WRAP_JAVA=OFF", "-DXDMF_WRAP_PYTHON=OFF", - "-DXDMF_BUILD_TESTING=ON", + "-DXDMF_BUILD_TESTING=OFF", ] return cmake_args