2011-06-16 02:55:26 +00:00
|
|
|
# - Find OpenEXR library
|
2011-06-15 12:09:02 +00:00
|
|
|
# Find the native OpenEXR includes and library
|
|
|
|
# This module defines
|
|
|
|
# OPENEXR_INCLUDE_DIRS, where to find ImfXdr.h, etc. Set when
|
|
|
|
# OPENEXR_INCLUDE_DIR is found.
|
|
|
|
# OPENEXR_LIBRARIES, libraries to link against to use OpenEXR.
|
|
|
|
# OPENEXR_ROOT_DIR, The base directory to search for OpenEXR.
|
|
|
|
# This can also be an environment variable.
|
|
|
|
# OPENEXR_FOUND, If false, do not try to use OpenEXR.
|
2011-06-16 02:48:07 +00:00
|
|
|
#
|
2012-02-17 19:21:47 +00:00
|
|
|
# For individual library access these advanced settings are available
|
2011-06-16 02:48:07 +00:00
|
|
|
# OPENEXR_HALF_LIBRARY, Path to Half library
|
|
|
|
# OPENEXR_IEX_LIBRARY, Path to Half library
|
|
|
|
# OPENEXR_ILMIMF_LIBRARY, Path to Ilmimf library
|
|
|
|
# OPENEXR_ILMTHREAD_LIBRARY, Path to IlmThread library
|
|
|
|
# OPENEXR_IMATH_LIBRARY, Path to Imath library
|
|
|
|
#
|
2011-06-15 12:09:02 +00:00
|
|
|
# also defined, but not for general use are
|
|
|
|
# OPENEXR_LIBRARY, where to find the OpenEXR library.
|
|
|
|
|
|
|
|
#=============================================================================
|
2011-06-20 02:54:56 +00:00
|
|
|
# Copyright 2011 Blender Foundation.
|
2011-06-15 12:09:02 +00:00
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
# If OPENEXR_ROOT_DIR was defined in the environment, use it.
|
|
|
|
IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
|
|
|
|
SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
|
|
|
|
ENDIF()
|
|
|
|
|
2014-07-19 13:59:51 +00:00
|
|
|
# Old versions (before 2.0?) do not have any version string, just assuming this should be fine though.
|
|
|
|
SET(_openexr_libs_ver_init "2.0")
|
|
|
|
|
2014-01-14 19:36:53 +00:00
|
|
|
SET(_openexr_FIND_COMPONENTS
|
|
|
|
Half
|
|
|
|
Iex
|
|
|
|
IlmImf
|
|
|
|
IlmThread
|
|
|
|
Imath
|
|
|
|
)
|
|
|
|
|
2013-12-16 20:00:35 +00:00
|
|
|
SET(_openexr_SEARCH_DIRS
|
|
|
|
${OPENEXR_ROOT_DIR}
|
|
|
|
/usr/local
|
|
|
|
/sw # Fink
|
|
|
|
/opt/local # DarwinPorts
|
|
|
|
/opt/csw # Blastwave
|
|
|
|
)
|
|
|
|
|
|
|
|
FIND_PATH(OPENEXR_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
OpenEXR/ImfXdr.h
|
|
|
|
HINTS
|
|
|
|
${_openexr_SEARCH_DIRS}
|
|
|
|
PATH_SUFFIXES
|
|
|
|
include
|
|
|
|
)
|
|
|
|
|
|
|
|
# If the headers were found, get the version from config file, if not already set.
|
2014-01-04 01:46:18 +00:00
|
|
|
IF(OPENEXR_INCLUDE_DIR)
|
|
|
|
IF(NOT OPENEXR_VERSION)
|
2014-01-04 02:12:45 +00:00
|
|
|
|
|
|
|
FIND_FILE(_openexr_CONFIG
|
|
|
|
NAMES
|
|
|
|
OpenEXRConfig.h
|
|
|
|
PATHS
|
|
|
|
"${OPENEXR_INCLUDE_DIR}"
|
|
|
|
"${OPENEXR_INCLUDE_DIR}/OpenEXR"
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
)
|
|
|
|
|
|
|
|
IF(_openexr_CONFIG)
|
|
|
|
FILE(STRINGS "${_openexr_CONFIG}" OPENEXR_BUILD_SPECIFICATION
|
|
|
|
REGEX "^[ \t]*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"[.0-9]+\".*$")
|
|
|
|
ELSE()
|
|
|
|
MESSAGE(WARNING "Could not find \"OpenEXRConfig.h\" in \"${OPENEXR_INCLUDE_DIR}\"")
|
|
|
|
ENDIF()
|
2013-12-16 20:00:35 +00:00
|
|
|
|
2014-01-04 01:46:18 +00:00
|
|
|
IF(OPENEXR_BUILD_SPECIFICATION)
|
|
|
|
MESSAGE(STATUS "${OPENEXR_BUILD_SPECIFICATION}")
|
|
|
|
STRING(REGEX REPLACE ".*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"([.0-9]+)\".*"
|
2014-07-19 13:59:51 +00:00
|
|
|
"\\1" _openexr_libs_ver_init ${OPENEXR_BUILD_SPECIFICATION})
|
2014-01-04 01:46:18 +00:00
|
|
|
ELSE()
|
2014-07-19 13:59:51 +00:00
|
|
|
MESSAGE(WARNING "Could not determine ILMBase library version, assuming ${_openexr_libs_ver_init}.")
|
2014-01-04 01:46:18 +00:00
|
|
|
ENDIF()
|
2014-01-04 02:12:45 +00:00
|
|
|
|
|
|
|
UNSET(_openexr_CONFIG CACHE)
|
|
|
|
|
2014-01-04 01:46:18 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2013-12-16 20:00:35 +00:00
|
|
|
|
2014-07-19 13:59:51 +00:00
|
|
|
SET("OPENEXR_VERSION" ${_openexr_libs_ver_init} CACHE STRING "Version of OpenEXR lib")
|
|
|
|
UNSET(_openexr_libs_ver_init)
|
|
|
|
|
2014-01-14 19:36:53 +00:00
|
|
|
STRING(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION})
|
2011-06-15 12:09:02 +00:00
|
|
|
|
|
|
|
SET(_openexr_LIBRARIES)
|
|
|
|
FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
|
|
|
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
|
|
|
|
2011-06-19 07:46:24 +00:00
|
|
|
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
|
2011-06-20 02:54:56 +00:00
|
|
|
NAMES
|
2014-01-14 20:50:03 +00:00
|
|
|
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
|
2011-06-20 02:54:56 +00:00
|
|
|
HINTS
|
|
|
|
${_openexr_SEARCH_DIRS}
|
|
|
|
PATH_SUFFIXES
|
|
|
|
lib64 lib
|
|
|
|
)
|
2011-06-15 12:09:02 +00:00
|
|
|
LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}")
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2014-01-14 19:36:53 +00:00
|
|
|
UNSET(_openexr_libs_ver)
|
|
|
|
|
2011-06-15 12:09:02 +00:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs)
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
2011-06-16 02:48:07 +00:00
|
|
|
_openexr_LIBRARIES OPENEXR_INCLUDE_DIR)
|
2011-06-15 12:09:02 +00:00
|
|
|
|
|
|
|
IF(OPENEXR_FOUND)
|
|
|
|
SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
|
2013-06-16 18:59:50 +00:00
|
|
|
# Both include paths are needed because of dummy OSL headers mixing #include <OpenEXR/foo.h> and #include <foo.h> :(
|
|
|
|
SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}/OpenEXR)
|
2011-06-18 12:12:19 +00:00
|
|
|
ENDIF()
|
2011-06-15 12:09:02 +00:00
|
|
|
|
2014-05-05 20:03:52 +00:00
|
|
|
MARK_AS_ADVANCED(
|
|
|
|
OPENEXR_INCLUDE_DIR
|
|
|
|
OPENEXR_VERSION
|
|
|
|
)
|
2011-06-16 02:48:07 +00:00
|
|
|
FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
|
|
|
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
|
|
|
MARK_AS_ADVANCED(OPENEXR_${UPPERCOMPONENT}_LIBRARY)
|
|
|
|
ENDFOREACH()
|