mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
CMake: Find OpenEXR, support it in pnmimagetypes
This commit is contained in:
parent
16be0770e7
commit
d43767c617
90
cmake/modules/FindOpenEXR.cmake
Normal file
90
cmake/modules/FindOpenEXR.cmake
Normal file
@ -0,0 +1,90 @@
|
||||
# Filename: FindOpenEXR.cmake
|
||||
# Authors: CFSworks (5 Nov, 2018)
|
||||
#
|
||||
# Usage:
|
||||
# find_package(OpenEXR [REQUIRED] [QUIET])
|
||||
#
|
||||
# Once done this will define:
|
||||
# OPENEXR_FOUND - system has OpenEXR
|
||||
# OPENEXR_INCLUDE_DIR - the include directory containing OpenEXR header files
|
||||
# OPENEXR_LIBRARIES - the path to the OpenEXR libraries
|
||||
#
|
||||
|
||||
if(NOT OPENEXR_INCLUDE_DIR)
|
||||
find_path(OPENEXR_INCLUDE_DIR
|
||||
"ImfVersion.h"
|
||||
PATH_SUFFIXES "OpenEXR")
|
||||
|
||||
mark_as_advanced(OPENEXR_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
find_library(OPENEXR_imf_LIBRARY
|
||||
NAMES "IlmImf")
|
||||
|
||||
if(OPENEXR_imf_LIBRARY)
|
||||
get_filename_component(_imf_dir "${OPENEXR_imf_LIBRARY}" DIRECTORY)
|
||||
find_library(OPENEXR_imfutil_LIBRARY
|
||||
NAMES "IlmImfUtil"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(OPENEXR_ilmthread_LIBRARY
|
||||
NAMES "IlmThread"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(OPENEXR_iex_LIBRARY
|
||||
NAMES "Iex"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(OPENEXR_iexmath_LIBRARY
|
||||
NAMES "IexMath"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(OPENEXR_imath_LIBRARY
|
||||
NAMES "Imath"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(OPENEXR_half_LIBRARY
|
||||
NAMES "Half"
|
||||
PATHS "${_imf_dir}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
unset(_imf_dir)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
OPENEXR_imf_LIBRARY
|
||||
OPENEXR_imfutil_LIBRARY
|
||||
OPENEXR_ilmthread_LIBRARY
|
||||
OPENEXR_iex_LIBRARY
|
||||
OPENEXR_iexmath_LIBRARY
|
||||
OPENEXR_imath_LIBRARY
|
||||
OPENEXR_half_LIBRARY
|
||||
)
|
||||
|
||||
set(OPENEXR_LIBRARIES
|
||||
${OPENEXR_imf_LIBRARY}
|
||||
${OPENEXR_imfutil_LIBRARY}
|
||||
${OPENEXR_ilmthread_LIBRARY}
|
||||
${OPENEXR_iex_LIBRARY}
|
||||
${OPENEXR_iexmath_LIBRARY}
|
||||
${OPENEXR_imath_LIBRARY}
|
||||
${OPENEXR_half_LIBRARY}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OpenEXR DEFAULT_MSG
|
||||
OPENEXR_INCLUDE_DIR OPENEXR_LIBRARIES
|
||||
|
||||
OPENEXR_imf_LIBRARY
|
||||
OPENEXR_imfutil_LIBRARY
|
||||
OPENEXR_ilmthread_LIBRARY
|
||||
OPENEXR_iex_LIBRARY
|
||||
OPENEXR_iexmath_LIBRARY
|
||||
OPENEXR_imath_LIBRARY
|
||||
OPENEXR_half_LIBRARY
|
||||
)
|
@ -149,6 +149,11 @@ find_package(TIFF QUIET)
|
||||
package_option(TIFF "Enable support for loading .tif images.")
|
||||
config_package(TIFF "libtiff")
|
||||
|
||||
# OpenEXR:
|
||||
find_package(OpenEXR QUIET)
|
||||
package_option(OPENEXR "Enable support for loading .exr images.")
|
||||
config_package(OPENEXR "OpenEXR")
|
||||
|
||||
#
|
||||
# ------------ LIBTAR ------------
|
||||
#
|
||||
|
@ -67,6 +67,9 @@
|
||||
/* Define if we have libtiff installed. */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Define if we have OpenEXR installed. */
|
||||
#cmakedefine HAVE_OPENEXR
|
||||
|
||||
/* Define if we want to build these other image file formats. */
|
||||
#cmakedefine HAVE_SGI_RGB
|
||||
#cmakedefine HAVE_TGA
|
||||
|
@ -33,7 +33,8 @@ set(P3PNMIMAGETYPES_SOURCES
|
||||
composite_sources(p3pnmimagetypes P3PNMIMAGETYPES_SOURCES)
|
||||
add_component_library(p3pnmimagetypes SYMBOL BUILDING_PANDA_PNMIMAGETYPES
|
||||
${P3PNMIMAGETYPES_HEADERS} ${P3PNMIMAGETYPES_SOURCES})
|
||||
target_link_libraries(p3pnmimagetypes p3pnmimage PKG::JPEG PKG::TIFF PKG::PNG)
|
||||
target_link_libraries(p3pnmimagetypes p3pnmimage
|
||||
PKG::JPEG PKG::TIFF PKG::PNG PKG::OPENEXR)
|
||||
set_target_properties(p3pnmimagetypes PROPERTIES CXX_EXCEPTIONS ON)
|
||||
|
||||
if(NOT BUILD_METALIBS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user