DepperDan/build_functions/build_hdf5.py

44 lines
1.5 KiB
Python

# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
from pathlib import Path
from build_functions.build_utils import print_banner
from common.azure import write_package_version_batch
from common.cmake import cmake_build_install
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
def build_hdf5(prefix: Path | str, sbom: dict):
print_banner("Building hdf5")
package_info = get_package_info("hdf5")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
hdf5_cmake_args = [
("H5EX_BUILD_EXAMPLES:BOOL", "OFF"),
("H5EX_BUILD_HL:BOOL", "OFF"),
("HDF5_BUILD_CPP_LIB:BOOL", "ON"),
("HDF5_BUILD_EXAMPLES:BOOL", "OFF"),
("HDF5_BUILD_TOOLS:BOOL", "OFF"),
("HDF5_BUILD_UTILS:BOOL", "OFF"),
# This might come in handy
("HDF5_ENABLE_SZIP_ENCODING:BOOL", "OFF"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("ZLIB_USE_STATIC_LIBS:BOOL", "ON"),
("ZLIB_LIBRARY_RELEASE:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name)),
("ZLIB_LIBRARY_DEBUG:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name))
]
hdf5_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(hdf5_dir, package_info, cmake_args=hdf5_cmake_args)
write_package_version_batch(package_info.version)
return install_dir