1# Try to find the OpenEXR libraries 2# This check defines: 3# 4# OPENEXR_FOUND - system has OpenEXR 5# OPENEXR_INCLUDE_DIR - OpenEXR include directory 6# OPENEXR_LIBRARIES - Libraries needed to use OpenEXR 7# 8# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> 9# 10# Redistribution and use is allowed according to the terms of the BSD license. 11# For details see the accompanying COPYING-CMAKE-SCRIPTS file. 12 13 14if (OPENEXR_INCLUDE_DIR AND OPENEXR_LIBRARIES) 15 # in cache already 16 SET(OPENEXR_FOUND TRUE) 17 18else (OPENEXR_INCLUDE_DIR AND OPENEXR_LIBRARIES) 19IF (NOT WIN32 OR MINGW) 20 # use pkg-config to get the directories and then use these values 21 # in the FIND_PATH() and FIND_LIBRARY() calls 22 INCLUDE(UsePkgConfig) 23 24 PKGCONFIG(OpenEXR _OpenEXRIncDir _OpenEXRLinkDir _OpenEXRLinkFlags _OpenEXRCflags) 25ENDIF (NOT WIN32 OR MINGW) 26 FIND_PATH(OPENEXR_INCLUDE_DIR ImfRgbaFile.h 27 ${_OpenEXRIncDir} 28 ${_OpenEXRIncDir}/OpenEXR/ 29 /usr/include 30 /usr/local/include 31 ${SOURCE_BASE_DIR}/Deploy/include 32 ${SOURCE_BASE_DIR}/Deploy/include/OpenEXR 33 ) 34 35 include(FindLibraryWithDebug) 36 find_library_with_debug(OPENEXR_HALF_LIBRARY 37 WIN32_DEBUG_POSTFIX d 38 NAMES Half 39 PATHS 40 ${_OPENEXRLinkDir} 41 ${SYSTEM_LIB_DIRS} 42 ${SOURCE_BASE_DIR}/Deploy/lib/ 43 ${SOURCE_BASE_DIR}/Deploy/lib/Release 44 ) 45 46 find_library_with_debug(OPENEXR_IEX_LIBRARY 47 WIN32_DEBUG_POSTFIX d 48 NAMES Iex-2_2 Iex 49 PATHS 50 ${_OPENEXRLinkDir} 51 ${SYSTEM_LIB_DIRS} 52 ${SOURCE_BASE_DIR}/Deploy/lib/ 53 ${SOURCE_BASE_DIR}/Deploy/lib/Release 54 ) 55 56 find_library_with_debug(OPENEXR_ILMTHREAD_LIBRARY 57 WIN32_DEBUG_POSTFIX d 58 NAMES IlmThread-2_2 IlmThread 59 PATHS 60 ${_OPENEXRLinkDir} 61 ${SYSTEM_LIB_DIRS} 62 ${SOURCE_BASE_DIR}/Deploy/lib/ 63 ${SOURCE_BASE_DIR}/Deploy/lib/Release 64 ) 65 66 find_library_with_debug(OPENEXR_IMATH_LIBRARY 67 WIN32_DEBUG_POSTFIX d 68 NAMES Imath-2_2 Imath 69 PATHS 70 ${_OPENEXRLinkDir} 71 ${SYSTEM_LIB_DIRS} 72 ${SOURCE_BASE_DIR}/Deploy/lib/ 73 ${SOURCE_BASE_DIR}/Deploy/lib/Release 74 ) 75 76 77 find_library_with_debug(OPENEXR_ILMIMF_LIBRARY 78 WIN32_DEBUG_POSTFIX d 79 NAMES IlmImf-2_2 IlmImf 80 PATHS 81 ${_OPENEXRLinkDir} 82 ${SYSTEM_LIB_DIRS} 83 ${SOURCE_BASE_DIR}/Deploy/lib/ 84 ${SOURCE_BASE_DIR}/Deploy/lib/Release 85 ) 86 87 if (OPENEXR_INCLUDE_DIR AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) 88 set(OPENEXR_FOUND TRUE) 89 if (OPENEXR_ILMTHREAD_LIBRARY) 90 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") 91 else (OPENEXR_ILMTHREAD_LIBRARY) 92 set(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR") 93 endif (OPENEXR_ILMTHREAD_LIBRARY) 94 endif (OPENEXR_INCLUDE_DIR AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) 95 96 97 98 if (OPENEXR_FOUND) 99 if (NOT OpenEXR_FIND_QUIETLY) 100 message(STATUS "Found OPENEXR: ${OPENEXR_LIBRARIES}") 101 endif (NOT OpenEXR_FIND_QUIETLY) 102 else (OPENEXR_FOUND) 103 if (OpenEXR_FIND_REQUIRED) 104 message(FATAL_ERROR "Could NOT find OPENEXR") 105 endif (OpenEXR_FIND_REQUIRED) 106 endif (OPENEXR_FOUND) 107 108 MARK_AS_ADVANCED( 109 OPENEXR_INCLUDE_DIR 110 OPENEXR_LIBRARIES 111 OPENEXR_ILMIMF_LIBRARY 112 OPENEXR_IMATH_LIBRARY 113 OPENEXR_IEX_LIBRARY 114 OPENEXR_HALF_LIBRARY 115 OPENEXR_ILMTHREAD_LIBRARY ) 116 117endif (OPENEXR_INCLUDE_DIR AND OPENEXR_LIBRARIES) 118