diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index 847ae83..6be6658 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -85,13 +85,21 @@ elif (version_ge "${version}" '1.12.2' && version_lt "${version}" '1.12.4') || wget -nc https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${ver_si_on}.tar.gz tar -xzf hdf5-${ver_si_on}.tar.gz -C ${src_dir} --strip-components=1 -else - # HDF5 >=1.10.12, <1.11 - # HDF5 >=1.12.4, <1.13 - # HDF5 >=1.14.4, <1.15 - # + catch-all +elif (version_ge "${version}" '1.10.12' && version_lt "${version}" '1.11') || # HDF5 >=1.10.12, <1.11 + (version_ge "${version}" '1.12.4' && version_lt "${version}" '1.13') || # HDF5 >=1.12.4, <1.13 + (version_ge "${version}" '1.14.4' && version_lt "${version}" '1.15'); then # HDF5 >=1.14.4, <1.15 + wget -nc https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_${version}.tar.gz + tar -xzf hdf5_${version}.tar.gz -C ${src_dir} --strip-components=1 + +elif version_lt "${version}" '2.0.0'; then + # + catch-all for remaining HDF5 1.x versions wget -nc https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_${version}.tar.gz tar -xzf hdf5_${version}.tar.gz -C ${src_dir} --strip-components=1 + +else + # HDF5 >=2.0.0 + wget -nc https://github.com/HDFGroup/hdf5/archive/refs/tags/${version}.tar.gz + tar -xzf ${version}.tar.gz -C ${src_dir} --strip-components=1 fi # Build and install @@ -100,18 +108,35 @@ mkdir -p ${install_dir} cd ${src_dir} -./configure \ - --prefix=${install_dir} \ - --enable-parallel \ - --enable-shared \ - CFLAGS=-fPIC \ - LDFLAGS=-fPIC \ - CPPFLAGS=-fPIC \ - CXXFLAGS=-fPIC \ - CC=mpicc \ - CXX=mpic++ && - make -j $parallel all && - make install +if version_lt "${version}" '2.0.0'; then # HDF5 < 2.0.0 + ./configure \ + --prefix=${install_dir} \ + --enable-parallel \ + --enable-shared \ + CFLAGS=-fPIC \ + LDFLAGS=-fPIC \ + CPPFLAGS=-fPIC \ + CXXFLAGS=-fPIC \ + CC=mpicc \ + CXX=mpic++ && + make -j ${parallel} all && + make install + +else # HDF5 >= 2.0.0 + # Check cmake version (HDF5 2.0+ requires cmake >= 3.26) + cmake --version + + mkdir -p build && cd build + CC=mpicc CXX=mpic++ cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DHDF5_BUILD_HL_LIB=ON \ + -DHDF5_BUILD_TOOLS=ON \ + -DHDF5_ENABLE_PARALLEL=ON .. && + make -j ${parallel} && + make install +fi # Add modulefile mkdir -p ${base_dir}/modulefiles/hdf5 diff --git a/scripts/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index 4ed27fb..3d745de 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -21,8 +21,6 @@ apt-get install -y --no-install-recommends \ # Build/dev dependencies apt-get install -y --no-install-recommends \ build-essential \ - cmake \ - cmake-curses-gui \ doxygen \ git \ lcov \ @@ -32,6 +30,9 @@ apt-get install -y --no-install-recommends \ python3-venv \ valgrind +# Install cmake 3.26+ for HDF5 2.0+ (Ubuntu 22.04 has cmake 3.22) +python3 -m pip install --no-cache-dir "cmake>=3.26,<5" + # Chaste dependencies apt-get install -y --no-install-recommends \ libfftw3-3 \