hdf5: support HDF5_PREFER_PARELLEL cmake option

pull/3859/head
Kumataro 3 months ago
parent 3e776c876e
commit 7fda317732
  1. 18
      modules/hdf/CMakeLists.txt
  2. 4
      modules/hdf/include/opencv2/hdf.hpp

@ -25,11 +25,23 @@ if(NOT HDF5_FOUND)
ocv_module_disable(hdf) # no return
endif()
set(HAVE_HDF5 1)
# See https://github.com/opencv/opencv_contrib/issues/3858
# If HDF5_PREFER_PARALLEL is enabled, find_package(HDF5) sets HDF5_IS_PARALLEL=ON.
if(HDF5_IS_PARALLEL)
find_package(MPI)
if(NOT MPI_FOUND)
message(STATUS "Module opencv_hdf disabled because the following dependency is not found: MPI")
ocv_module_disable(hdf) # no return
endif()
else()
unset(MPI_CXX_LIBRARIES)
unset(MPI_CXX_INCLUDE_DIRS)
endif()
set(HAVE_HDF5 1)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Winvalid-offsetof)
set(the_description "Hierarchical Data Format I/O")
ocv_define_module(hdf opencv_core WRAP python)
ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES})
ocv_include_directories(${HDF5_INCLUDE_DIRS})
ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES} ${MPI_CXX_LIBRARIES})
ocv_include_directories(${HDF5_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_DIRS})

@ -49,6 +49,10 @@ This module provides storage routines for Hierarchical Data Format objects.
In order to use it, the hdf5 library has to be installed, which
means cmake should find it using `find_package(HDF5)`.
You can use parallel hdf5 library with `-DHDF5_PREFER_PARELLEL=ON` cmake option.
Depended MPI library(e.g. Open MPI or MPICH) is detected in `find_package(MPI)`.
To set prefer MPI library, `update-alternatives` command is helpful for your Ubuntu.
@}
*/

Loading…
Cancel
Save