attached fixes for configuring and building the osgPlugin exr with Visual Studio and using out-of-the-box builds of ilmbase and openexr, i.e. without manual/extra config for using these 2 libs with the OSG.

Previously, the assumption was made that ilmbase and openexr were installed in a common directory and hence the header files and libs were both found in that common directory. That is not consistent with other libs and this submission makes it consistent and therefore the OSG configures out of the box. I made this work for ilmbase-2.1.0.tar.gz / openexr-2.1.0.tar.gz and ilmbase-2.2.0.tar.gz / openexr-2.2.0.tar.gz
This commit is contained in:
Raymond de Vries 2017-11-14 10:38:18 +00:00 committed by Robert Osfield
parent 49a5fdbd1f
commit 41dda781ee
4 changed files with 71 additions and 9 deletions

View File

@ -742,6 +742,7 @@ IF(ANDROID)
ELSE()
# Common to all platforms except android:
FIND_PACKAGE(Freetype)
FIND_PACKAGE(ilmbase)
FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR)

View File

@ -28,7 +28,7 @@ FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
# example: OPENEXR_FIND_VAR(OPENEXR_IlmImf_LIBRARY IlmImf)
MACRO(OPENEXR_FIND_VAR varname libname)
FIND_LIBRARY( ${varname}
NAMES ${libname}
NAMES ${libname} ${libname}-2_1 ${libname}-2_2
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
@ -52,13 +52,10 @@ MACRO(OPENEXR_FIND libname)
ENDMACRO(OPENEXR_FIND)
OPENEXR_FIND(IlmImf)
OPENEXR_FIND(IlmThread)
OPENEXR_FIND(Iex)
OPENEXR_FIND(Half)
SET(OPENEXR_FOUND "NO")
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
SET(OPENEXR_LIBRARIES ${OPENEXR_IlmImf_LIBRARY} ${OPENEXR_IlmThread_LIBRARY} ${OPENEXR_Half_LIBRARY} ${OPENEXR_Iex_LIBRARY} )
SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmImf_LIBRARY OPENEXR_IlmThread_LIBRARY OPENEXR_Half_LIBRARY OPENEXR_Iex_LIBRARY )
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY)
SET(OPENEXR_LIBRARIES ${OPENEXR_IlmImf_LIBRARY} )
SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmImf_LIBRARY )
SET(OPENEXR_FOUND "YES")
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY)

View File

@ -0,0 +1,63 @@
# Locate ILMBASE
# This module defines
# ILMBASE_LIBRARY
# ILMBASE_FOUND, if false, do not try to link to ILMBASE
# ILMBASE_INCLUDE_DIR, where to find the headers
#
# $ILMBASE_DIR is an environment variable that would
# correspond to the ./configure --prefix=$ILMBASE_DIR
#
# Created by Robert Osfield.
FIND_PATH(ILMBASE_INCLUDE_DIR OpenEXR/ImathVec.h
$ENV{ILMBASE_DIR}/include
$ENV{ILMBASE_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)
# Macro to find ilmbase libraries
# example: ILMBASE_FIND_VAR(OPENEXR_IlmThread_LIBRARY IlmThread)
MACRO(ILMBASE_FIND_VAR varname libname)
FIND_LIBRARY( ${varname}
NAMES ${libname} ${libname}-2_1 ${libname}-2_2
PATHS
$ENV{ILMBASE_DIR}/lib
$ENV{ILMBASE_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
ENDMACRO(ILMBASE_FIND_VAR)
# Macro to find exr libraries (and debug versions)
# example: ILMBASE_FIND(OPENEXR_IlmThread_LIBRARY IlmThread)
MACRO(ILMBASE_FIND libname)
ILMBASE_FIND_VAR(ILMBASE_${libname}_LIBRARY ${libname})
ILMBASE_FIND_VAR(ILMBASE_${libname}_LIBRARY_DEBUG ${libname}d)
ENDMACRO(ILMBASE_FIND)
ILMBASE_FIND(IlmThread)
ILMBASE_FIND(Iex)
ILMBASE_FIND(Half)
SET(ILMBASE_FOUND "NO")
IF(ILMBASE_INCLUDE_DIR AND ILMBASE_IlmThread_LIBRARY AND ILMBASE_Iex_LIBRARY AND ILMBASE_Half_LIBRARY)
SET(ILMBASE_LIBRARIES ${ILMBASE_IlmThread_LIBRARY} ${ILMBASE_Half_LIBRARY} ${ILMBASE_Iex_LIBRARY} )
SET(ILMBASE_LIBRARIES_VARS ILMBASE_IlmThread_LIBRARY ILMBASE_Half_LIBRARY ILMBASE_Iex_LIBRARY )
SET(ILMBASE_FOUND "YES")
ENDIF(ILMBASE_INCLUDE_DIR AND ILMBASE_IlmThread_LIBRARY AND ILMBASE_Iex_LIBRARY AND ILMBASE_Half_LIBRARY)

View File

@ -1,8 +1,9 @@
INCLUDE_DIRECTORIES( ${ILMBASE_INCLUDE_DIR}/OpenEXR )
INCLUDE_DIRECTORIES( ${OPENEXR_INCLUDE_DIR}/OpenEXR )
SET(TARGET_SRC ReaderWriterEXR.cpp )
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARIES)
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ${ILMBASE_LIBRARIES_VARS} ZLIB_LIBRARIES)
IF(CMAKE_COMPILER_IS_GNUCXX)
# Remove -Wshadow flag as it barfs on ffmoeg headers