CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
  2. if(WIN32)
  3. # windows cmake internal lookups are broken for now
  4. # will lookup for headers and shared libs given HDF_DIR env
  5. find_path(HDF5_INCLUDE_DIRS hdf5.h HINTS "$ENV{HDF5_DIR}\\..\\include")
  6. find_library(HDF5_C_LIBRARY NAMES hdf5 HINTS "$ENV{HDF5_DIR}\\..\\lib")
  7. if(HDF5_INCLUDE_DIRS AND HDF5_C_LIBRARY)
  8. set(HDF5_FOUND "YES")
  9. set(HDF5_LIBRARIES ${HDF5_C_LIBRARY})
  10. mark_as_advanced(HDF5_LIBRARIES)
  11. mark_as_advanced(HDF5_C_LIBRARY)
  12. mark_as_advanced(HDF5_INCLUDE_DIRS)
  13. add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB -D_HDF5USEDLL_)
  14. else()
  15. set(HDF5_FOUND "NO")
  16. endif()
  17. else()
  18. if(NOT CMAKE_CROSSCOMPILING) # iOS build should not reuse OSX package
  19. find_package(HDF5)
  20. endif()
  21. endif()
  22. if(NOT HDF5_FOUND)
  23. ocv_module_disable(hdf) # no return
  24. endif()
  25. set(HAVE_HDF5 1)
  26. ocv_warnings_disable(CMAKE_CXX_FLAGS -Winvalid-offsetof)
  27. set(the_description "Hierarchical Data Format I/O")
  28. ocv_define_module(hdf opencv_core WRAP python)
  29. ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES})
  30. ocv_include_directories(${HDF5_INCLUDE_DIRS})