Merge pull request #21329 from alalek:cmake_openexr_find_package

pull/21341/head
Alexander Alekhin 3 years ago
commit 92651d228d
  1. 4
      CMakeLists.txt
  2. 1
      cmake/OpenCVFindLibsGrfmt.cmake
  3. 21
      cmake/OpenCVFindOpenEXR.cmake
  4. 1
      modules/imgcodecs/src/grfmt_exr.hpp

@ -224,7 +224,7 @@ OCV_OPTION(BUILD_TIFF "Build libtiff from source" (WIN32
OCV_OPTION(BUILD_JASPER "Build libjasper from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_JPEG "Build libjpeg from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_PNG "Build libpng from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_WEBP "Build WebP from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_TBB "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
OCV_OPTION(BUILD_IPP_IW "Build IPP IW from source" (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD) IF (X86_64 OR X86) AND NOT WINRT )
@ -306,7 +306,7 @@ OCV_OPTION(WITH_JPEG "Include JPEG support" ON
OCV_OPTION(WITH_WEBP "Include WebP support" ON
VISIBLE_IF NOT WINRT
VERIFY HAVE_WEBP)
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" BUILD_OPENEXR OR NOT CMAKE_CROSSCOMPILING
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ((WIN32 OR ANDROID OR APPLE) OR BUILD_OPENEXR) OR NOT CMAKE_CROSSCOMPILING
VISIBLE_IF NOT APPLE_FRAMEWORK AND NOT WINRT
VERIFY HAVE_OPENEXR)
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF

@ -242,6 +242,7 @@ if(WITH_OPENEXR)
if(OPENEXR_VERSION) # check via TARGET doesn't work
set(BUILD_OPENEXR ON)
set(HAVE_OPENEXR YES)
set(BUILD_OPENEXR ON)
endif()
endif()
endif()

@ -9,6 +9,27 @@
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
#
if(NOT HAVE_CXX11)
message(STATUS "OpenEXR: enable C++11 to use external OpenEXR")
return()
endif()
if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE)
find_package(OpenEXR 3 QUIET)
#ocv_cmake_dump_vars(EXR)
if(OpenEXR_FOUND)
if(TARGET OpenEXR::OpenEXR) # OpenEXR 3+
set(OPENEXR_LIBRARIES OpenEXR::OpenEXR)
set(OPENEXR_INCLUDE_PATHS "")
set(OPENEXR_VERSION "${OpenEXR_VERSION}")
set(OPENEXR_FOUND 1)
return()
else()
message(STATUS "Unsupported find_package(OpenEXR) - missing OpenEXR::OpenEXR target (version ${OpenEXR_VERSION})")
endif()
endif()
endif()
SET(OPENEXR_LIBRARIES "")
SET(OPENEXR_LIBSEARCH_SUFFIXES "")
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)

@ -53,6 +53,7 @@
#include <ImfInputFile.h>
#include <ImfChannelList.h>
#include <ImathBox.h>
#include <ImfRgbaFile.h>
#include "grfmt_base.hpp"
namespace cv

Loading…
Cancel
Save