cmake: fix Linux system OpenEXR detection

pull/16294/head
h6197627 5 years ago
parent f6137292f1
commit fb3a334bbe
  1. 55
      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()

Loading…
Cancel
Save