hdf5: Add PACKAGECONFIG for the C++ library

Since 1.14.0 upstream no longer builds the C++ library (libhdf5_cpp,
libhdf5_hl_cpp) by default, so recipes that need it fail to find it.
Add a "cpp" PACKAGECONFIG to turn on HDF5_BUILD_CPP_LIB, keeping it
disabled by default.

The C++ build also installs the h5c++ compiler wrapper, which needs the
same RECIPE_SYSROOT_NATIVE cleanup and multilib script handling as h5cc.

Fixes: https://github.com/openembedded/meta-openembedded/issues/814

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-10-26 17:04:30 -07:00
1 parent 87b0eeb4a7
commit 186175d96c
1 file changed
+10 -1
+10 -1
View File
@@ -35,6 +35,10 @@ EXTRA_OECMAKE = " \
-DCMAKE_INSTALL_PREFIX='${prefix}' \
-DHDF5_INSTALL_LIB_DIR='${baselib}' \
"
PACKAGECONFIG ??= ""
PACKAGECONFIG[cpp] = "-DHDF5_BUILD_CPP_LIB=ON,-DHDF5_BUILD_CPP_LIB=OFF"
EXTRA_OECMAKE:prepend:class-target = "-DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper "
gen_emu() {
@@ -60,9 +64,14 @@ do_install:append() {
# Used for generating config files on target
oe_multilib_header H5pubconf.h
sed -i -e 's|${RECIPE_SYSROOT_NATIVE}||g' ${D}${bindir}/h5cc
if ${@bb.utils.contains('PACKAGECONFIG', 'cpp', 'true', 'false', d)}; then
sed -i -e 's|${RECIPE_SYSROOT_NATIVE}||g' ${D}${bindir}/h5c++
fi
}
MULTILIB_SCRIPTS += "${PN}:${bindir}/h5cc"
MULTILIB_SCRIPTS += "${PN}:${bindir}/h5cc \
${@bb.utils.contains('PACKAGECONFIG', 'cpp', '${PN}:${bindir}/h5c++', '', d)} \
"
BBCLASSEXTEND = "native"