From d21009c323ab0bff1de9e4a614e3f3b93051e2dc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 19 Jan 2011 10:57:58 +0000 Subject: [PATCH] From Simon Julier, "I ran across linking errors with osgdb_exr. Specifically, I found it was necessary to link against libImlIlf, libImlThread, libHalf, libIex and libzip. I have attached a patch, against the trunk from 13:30 today, which consists of the following: 1. CMakeModules/FindOpenEXR.cmake: Look for libIlmThread and libIex as well. 2. src/osgPlugins/CMakeList.txt: Only include the exr subdirectory if both the OpenEXR and zip libraries were found. 3. src/osgPlugins/exr/CMakeLists.txt: Add ZIP_LIBRARY to TARGET_EXTERNAL_LIBRARIES." --- CMakeModules/FindOpenEXR.cmake | 39 +++++++++++++++++++++++++++++-- src/osgPlugins/CMakeLists.txt | 2 +- src/osgPlugins/exr/CMakeLists.txt | 2 +- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/CMakeModules/FindOpenEXR.cmake b/CMakeModules/FindOpenEXR.cmake index 50ef9ec58..5b73b1522 100644 --- a/CMakeModules/FindOpenEXR.cmake +++ b/CMakeModules/FindOpenEXR.cmake @@ -39,6 +39,39 @@ FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY /usr/freeware/lib64 ) +FIND_LIBRARY(OPENEXR_IlmThread_LIBRARY + NAMES IlmThread + PATHS + $ENV{OPENEXR_DIR}/lib + $ENV{OPENEXR_DIR} + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + + +FIND_LIBRARY(OPENEXR_Iex_LIBRARY + NAMES Iex + PATHS + $ENV{OPENEXR_DIR}/lib + $ENV{OPENEXR_DIR} + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + FIND_LIBRARY(OPENEXR_Half_LIBRARY NAMES Half PATHS @@ -56,10 +89,12 @@ FIND_LIBRARY(OPENEXR_Half_LIBRARY ) SET(OPENEXR_FOUND "NO") -IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_Half_LIBRARY) +IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY) SET(OPENEXR_LIBRARIES ${OPENEXR_IlmIlf_LIBRARY} + ${OPENEXR_IlmThread_LIBRARY} ${OPENEXR_Half_LIBRARY} + ${OPENEXR_Iex_LIBRARY} ) SET(OPENEXR_FOUND "YES") -ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_Half_LIBRARY) +ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY) diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt index a35533062..50768cf76 100644 --- a/src/osgPlugins/CMakeLists.txt +++ b/src/osgPlugins/CMakeLists.txt @@ -84,7 +84,7 @@ ENDIF() IF(JASPER_FOUND) ADD_SUBDIRECTORY(jp2) ENDIF() -IF(OPENEXR_FOUND) +IF(OPENEXR_FOUND AND ZLIB_FOUND) ADD_SUBDIRECTORY(exr) ENDIF() IF(GIFLIB_FOUND) diff --git a/src/osgPlugins/exr/CMakeLists.txt b/src/osgPlugins/exr/CMakeLists.txt index c1adf7f03..8d6f83b50 100644 --- a/src/osgPlugins/exr/CMakeLists.txt +++ b/src/osgPlugins/exr/CMakeLists.txt @@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${OPENEXR_INCLUDE_DIR}/OpenEXR ) SET(TARGET_SRC ReaderWriterEXR.cpp ) -SET(TARGET_EXTERNAL_LIBRARIES ${OPENEXR_LIBRARIES} ) +SET(TARGET_EXTERNAL_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARY} ) #### end var setup ### SETUP_PLUGIN(exr)