#1568 support of building with OpenEXR on Windows

This commit is contained in:
Andrey Kamaev 2012-02-27 06:23:14 +00:00
parent c6445e2de1
commit cb9823704c
2 changed files with 40 additions and 12 deletions

View File

@ -9,42 +9,68 @@
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
# #
SET(OPENEXR_LIBRARIES) SET(OPENEXR_LIBRARIES "")
SET(OPENEXR_LIBSEARCH_SUFFIXES "")
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
if(WIN32)
SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")
if(CMAKE_CL_64)
SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)
elseif(MSVC)
SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
endif()
else()
set(OPENEXR_ROOT "")
endif()
SET(LIBRARY_PATHS SET(LIBRARY_PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/sw/lib /sw/lib
/opt/local/lib /opt/local/lib
$ENV{PROGRAM_FILES}/OpenEXR/lib/static) "${ProgramFiles_ENV_PATH}/OpenEXR/lib/static"
"${OPENEXR_ROOT}/lib")
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
PATH_SUFFIXES OpenEXR PATH_SUFFIXES OpenEXR
PATHS
/usr/include /usr/include
/usr/local/include /usr/local/include
/sw/include /sw/include
/opt/local/include) /opt/local/include
"${ProgramFiles_ENV_PATH}/OpenEXR/include"
"${OPENEXR_ROOT}/include")
FIND_LIBRARY(OPENEXR_HALF_LIBRARY FIND_LIBRARY(OPENEXR_HALF_LIBRARY
NAMES Half NAMES Half
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_IEX_LIBRARY FIND_LIBRARY(OPENEXR_IEX_LIBRARY
NAMES Iex NAMES Iex
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_IMATH_LIBRARY FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
NAMES Imath NAMES Imath
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
NAMES IlmImf NAMES IlmImf
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
NAMES IlmThread
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
PATHS ${LIBRARY_PATHS}) PATHS ${LIBRARY_PATHS})
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
SET(OPENEXR_FOUND TRUE) SET(OPENEXR_FOUND TRUE)
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR") SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR")
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR") SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE)
ENDIF () ENDIF ()
IF(OPENEXR_FOUND) IF(OPENEXR_FOUND)
@ -59,7 +85,9 @@ ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENEXR_INCLUDE_PATHS OPENEXR_INCLUDE_PATHS
OPENEXR_LIBRARIES
OPENEXR_ILMIMF_LIBRARY OPENEXR_ILMIMF_LIBRARY
OPENEXR_IMATH_LIBRARY OPENEXR_IMATH_LIBRARY
OPENEXR_IEX_LIBRARY OPENEXR_IEX_LIBRARY
OPENEXR_HALF_LIBRARY) OPENEXR_HALF_LIBRARY
OPENEXR_ILMTHREAD_LIBRARY)

View File

@ -90,5 +90,5 @@ endif()
################### OpenEXR - optional ################### OpenEXR - optional
if(WITH_OPENEXR) if(WITH_OPENEXR)
include(cmake/OpenCVFindOpenEXR.cmake) include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
endif() endif()