1 # - Find OpenEXR image format libraries
2 # Find the OpenEXR high dynamic range (HDR) image format libraries and headers
4 # This module specifies the following variables:
9 # Additionally the following more specialized variables are defined:
10 # OPENEXR_LIBRARY_DEBUG debug library
11 # OPENEXR_LIBRARY_RELEASE release library
13 # You can control where this module attempts to locate libraries and headers:
15 # OPENEXR_ROOT_DIR look for headers in ${OPENEXR_ROOT_DIR}/include/OpenEXR
16 # look for libs in ${OPENEXR_ROOT_DIR}/lib
17 # OPENEXR_INCLUDE_DIR look for headers in ${OPENEXR_INCLUDE_DIR}/OpenEXR
18 # OPENEXR_LIBRARY_DIR look for libs in ${OPENEXR_LIBRARY_DIR}
20 # Note: Setting these variables will skip searching the system default paths.
23 # default include search paths
24 SET(__OPENEXR_INCLUDE_SEARCH_DIRS
33 # default library search paths
34 SET(__OPENEXR_LIBRARY_SEARCH_DIRS
47 # handle OPENEXR_ROOT_DIR input variable
49 FILE(TO_CMAKE_PATH ${OPENEXR_ROOT_DIR} OPENEXR_ROOT_DIR)
51 SET(__OPENEXR_INCLUDE_SEARCH_DIRS "${OPENEXR_ROOT_DIR}/include"
52 "${__OPENEXR_INCLUDE_SEARCH_DIRS}")
54 SET(__OPENEXR_LIBDIR_SUFFIX_IN "${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}")
56 STRING(TOLOWER ${__OPENEXR_LIBDIR_SUFFIX_IN} __OPENEXR_LIBDIR_SUFFIX)
58 SET(__OPENEXR_LIBRARY_SEARCH_DIRS "${OPENEXR_ROOT_DIR}/lib/${__OPENEXR_LIBDIR_SUFFIX}"
59 "${OPENEXR_ROOT_DIR}/lib"
60 "${__OPENEXR_LIBRARY_SEARCH_DIRS}")
62 # skip default paths since the user specified explicit ones
63 SET(__OPENEXR_NO_DEFAULT_INC_PATH NO_DEFAULT_PATH)
64 SET(__OPENEXR_NO_DEFAULT_LIB_PATH NO_DEFAULT_PATH)
65 ENDIF(OPENEXR_ROOT_DIR)
68 # handle OPENEXR_INCLUDE_DIR input variable
69 IF(OPENEXR_INCLUDE_DIR)
70 FILE(TO_CMAKE_PATH ${OPENEXR_INCLUDE_DIR} OPENEXR_INCLUDE_DIR)
71 SET(__OPENEXR_INCLUDE_SEARCH_DIRS "${OPENEXR_INCLUDE_DIR}"
72 "${__OPENEXR_INCLUDE_SEARCH_DIRS}")
73 SET(__OPENEXR_NO_DEFAULT_INC_PATH NO_DEFAULT_PATH)
74 ENDIF(OPENEXR_INCLUDE_DIR)
76 # handle OPENEXR_LIBRARY_DIR input variable
77 IF(OPENEXR_LIBRARY_DIR)
78 FILE(TO_CMAKE_PATH ${OPENEXR_LIBRARY_DIR} OPENEXR_LIBRARY_DIR)
79 SET(__OPENEXR_LIBRARY_SEARCH_DIRS "${OPENEXR_LIBRARY_DIR}"
80 "${__OPENEXR_LIBRARY_SEARCH_DIRS}")
81 SET(__OPENEXR_NO_DEFAULT_LIB_PATH NO_DEFAULT_PATH)
82 ENDIF(OPENEXR_LIBRARY_DIR)
86 FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
87 PATHS ${__OPENEXR_INCLUDE_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_INC_PATH})
90 FIND_LIBRARY(OPENEXR_LIBRARY_IMF_RELEASE
92 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
94 FIND_LIBRARY(OPENEXR_LIBRARY_HALF_RELEASE
96 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
98 FIND_LIBRARY(OPENEXR_LIBRARY_IEX_RELEASE
100 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
102 FIND_LIBRARY(OPENEXR_LIBRARY_ILMTHREAD_RELEASE
104 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
107 FIND_LIBRARY(OPENEXR_LIBRARY_IMF_DEBUG
108 NAMES IlmImf-d IlmImfd
109 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
111 FIND_LIBRARY(OPENEXR_LIBRARY_HALF_DEBUG
112 NAMES Half-d Halfd ilmhalf-d ilmhalfd
113 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
115 FIND_LIBRARY(OPENEXR_LIBRARY_IEX_DEBUG
116 NAMES Iex-d Iexd ilmiex-d ilmiexd
117 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
119 FIND_LIBRARY(OPENEXR_LIBRARY_ILMTHREAD_DEBUG
120 NAMES IlmThread-d IlmThreadd
121 PATHS ${__OPENEXR_LIBRARY_SEARCH_DIRS} ${__OPENEXR_NO_DEFAULT_LIB_PATH})
125 # handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
126 # all listed variables are TRUE
127 INCLUDE(FindPackageHandleStandardArgs)
128 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENEXR DEFAULT_MSG
129 OPENEXR_LIBRARY_IMF_RELEASE
130 OPENEXR_LIBRARY_HALF_RELEASE
131 OPENEXR_LIBRARY_IEX_RELEASE
132 OPENEXR_LIBRARY_ILMTHREAD_RELEASE
135 IF(OPENEXR_INCLUDE_DIR)
136 LIST(APPEND OPENEXR_INCLUDE_DIR "${OPENEXR_INCLUDE_DIR}/OpenEXR")
137 ENDIF(OPENEXR_INCLUDE_DIR)
139 # set output variables
141 LIST(APPEND OPENEXR_LIBRARIES "${OPENEXR_LIBRARY_IMF_RELEASE}")
142 LIST(APPEND OPENEXR_LIBRARIES "${OPENEXR_LIBRARY_HALF_RELEASE}")
143 LIST(APPEND OPENEXR_LIBRARIES "${OPENEXR_LIBRARY_IEX_RELEASE}")
144 LIST(APPEND OPENEXR_LIBRARIES "${OPENEXR_LIBRARY_ILMTHREAD_RELEASE}")
146 # LIST(APPEND OPENEXR_LIBRARIES "debug:${OPENEXR_LIBRARY_IMF_RELEASE}")
147 # LIST(APPEND OPENEXR_LIBRARIES "debug:${OPENEXR_LIBRARY_HALF_RELEASE}")
148 # LIST(APPEND OPENEXR_LIBRARIES "debug:${OPENEXR_LIBRARY_IEX_RELEASE}")
150 # SET(OPENEXR_LIBRARIES_RELEASE "${OPENEXR_LIBRARY_IMF_RELEASE}"
151 # "${OPENEXR_LIBRARY_HALF_RELEASE}"
152 # "${OPENEXR_LIBRARY_IEX_RELEASE}")
154 # SET(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARY_IMF_DEBUG}"
155 # "${OPENEXR_LIBRARY_HALF_DEBUG}"
156 # "${OPENEXR_LIBRARY_IEX_DEBUG}")