You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
opencv/fb3a334bbee3535d508af6510d9...

90 lines
3.3 KiB

From fb3a334bbee3535d508af6510d9903d26ba37d34 Mon Sep 17 00:00:00 2001
From: h6197627 <aon70983@cndps.com>
Date: Mon, 6 Jan 2020 15:52:40 +0200
Subject: [PATCH] cmake: fix Linux system OpenEXR detection
---
cmake/OpenCVFindOpenEXR.cmake | 55 ++++++++++++++++++-----------------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake
index fb6c2fa1469..9103f1f5a71 100644
--- a/cmake/OpenCVFindOpenEXR.cmake
+++ b/cmake/OpenCVFindOpenEXR.cmake
@@ -20,6 +20,8 @@ if(WIN32)
elseif(MSVC)
SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
endif()
+elseif(UNIX)
+ SET(OPENEXR_LIBSEARCH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE})
endif()
SET(SEARCH_PATHS
@@ -39,6 +41,25 @@ MACRO(FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX)
PATHS "${SEARCH_PATH}/lib" "${SEARCH_PATH}/lib/static")
ENDMACRO()
+MACRO(ocv_find_openexr LIBRARY_SUFFIX)
+ IF(NOT OPENEXR_FOUND)
+ FIND_OPENEXR_LIBRARY("Half" "${LIBRARY_SUFFIX}")
+ FIND_OPENEXR_LIBRARY("Iex" "${LIBRARY_SUFFIX}")
+ FIND_OPENEXR_LIBRARY("Imath" "${LIBRARY_SUFFIX}")
+ FIND_OPENEXR_LIBRARY("IlmImf" "${LIBRARY_SUFFIX}")
+ FIND_OPENEXR_LIBRARY("IlmThread" "${LIBRARY_SUFFIX}")
+ IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY AND OPENEXR_ILMTHREAD_LIBRARY)
+ SET(OPENEXR_FOUND TRUE)
+ ELSE()
+ UNSET(OPENEXR_IMATH_LIBRARY)
+ UNSET(OPENEXR_ILMIMF_LIBRARY)
+ UNSET(OPENEXR_IEX_LIBRARY)
+ UNSET(OPENEXR_ILMTHREAD_LIBRARY)
+ UNSET(OPENEXR_HALF_LIBRARY)
+ ENDIF()
+ ENDIF()
+ENDMACRO()
+
FOREACH(SEARCH_PATH ${SEARCH_PATHS})
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
PATH_SUFFIXES OpenEXR
@@ -64,32 +85,14 @@ FOREACH(SEARCH_PATH ${SEARCH_PATHS})
set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}")
ENDIF ()
- SET(LIBRARY_SUFFIXES
- "-${OPENEXR_VERSION}"
- "-${OPENEXR_VERSION}_s"
- "-${OPENEXR_VERSION}_d"
- "-${OPEXEXR_VERSION}_s_d"
- ""
- "_s"
- "_d"
- "_s_d")
-
- FOREACH(LIBRARY_SUFFIX ${LIBRARY_SUFFIXES})
- FIND_OPENEXR_LIBRARY("Half" ${LIBRARY_SUFFIX})
- FIND_OPENEXR_LIBRARY("Iex" ${LIBRARY_SUFFIX})
- FIND_OPENEXR_LIBRARY("Imath" ${LIBRARY_SUFFIX})
- FIND_OPENEXR_LIBRARY("IlmImf" ${LIBRARY_SUFFIX})
- FIND_OPENEXR_LIBRARY("IlmThread" ${LIBRARY_SUFFIX})
- IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
- SET(OPENEXR_FOUND TRUE)
- BREAK()
- ENDIF()
- UNSET(OPENEXR_IMATH_LIBRARY)
- UNSET(OPENEXR_ILMIMF_LIBRARY)
- UNSET(OPENEXR_IEX_LIBRARY)
- UNSET(OPENEXR_ILMTHREAD_LIBRARY)
- UNSET(OPENEXR_HALF_LIBRARY)
- ENDFOREACH()
+ ocv_find_openexr("-${OPENEXR_VERSION}")
+ ocv_find_openexr("-${OPENEXR_VERSION}_s")
+ ocv_find_openexr("-${OPENEXR_VERSION}_d")
+ ocv_find_openexr("-${OPEXEXR_VERSION}_s_d")
+ ocv_find_openexr("")
+ ocv_find_openexr("_s")
+ ocv_find_openexr("_d")
+ ocv_find_openexr("_s_d")
IF (OPENEXR_FOUND)
BREAK()