review to allow custom OpenEXR libraries (issue909042)


cliffo...@...
 

Reviewers: osl-dev_googlegroups.com, dev-osl_imageworks.com,

Description:
This is similar to a patch I've submitted to OpenImageIO. I'll
cut-n-paste the same patch description here:

This review allows one to specify custom OpenEXR library names. This
has come up here at SPI where we're using OpenEXR libraries with custom
filenames in our new OS to avoid "collisions" with the system installed
libraries.

I've tested this on our two Linux platforms here at SPI -- one uses
custom OpenEXR library filenames while the other does not.


Please review this at http://codereview.appspot.com/909042/show

Affected files:
site/spi/Makefile-bits
src/cmake/externalpackages.cmake


Index: site/spi/Makefile-bits
===================================================================
--- site/spi/Makefile-bits (revision 616)
+++ site/spi/Makefile-bits (working copy)
@@ -4,6 +4,11 @@

ifeq ($(SP_ARCH), spinux1_x86_64)
# put any gcc-4.4/spinux1 specific stuff here
+MY_CMAKE_FLAGS += \
+ -DILMBASE_CUSTOM=1 \
+ -DILMBASE_CUSTOM_LIBRARIES="SpiImath SpiHalf SpiIlmThread SpiIex" \
+ -DOPENEXR_CUSTOM=1 \
+ -DOPENEXR_CUSTOM_LIBRARY="SpiIlmImf"

#BOOST_VERSION=1_42
#Boost_LIBRARIES="-lboost_filesystem-gcc44-mt -lboost_regex-gcc44-mt -lboost_thread-gcc44-mt"
Index: src/cmake/externalpackages.cmake
===================================================================
--- src/cmake/externalpackages.cmake (revision 616)
+++ src/cmake/externalpackages.cmake (working copy)
@@ -49,16 +49,24 @@
${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION}
${ILMBASE_HOME}/include
)
-foreach (_lib Imath Half IlmThread Iex)
- find_library (ILMBASE_LIBS_${_lib} ${_lib}
+if (ILMBASE_CUSTOM)
+ set (IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES})
+ separate_arguments(IlmBase_Libraries)
+else ()
+ set (IlmBase_Libraries Imath Half IlmThread Iex)
+endif ()
+
+foreach (_lib ${IlmBase_Libraries})
+ find_library (current_lib ${_lib}
PATHS ${ILMBASE_HOME}/lib ${ILMBASE_HOME}/lib64
${ILMBASE_LIB_AREA}
)
+ list(APPEND ILMBASE_LIBRARIES ${current_lib})
endforeach ()
-set (ILMBASE_LIBRARIES ${ILMBASE_LIBS_Imath} ${ILMBASE_LIBS_Half}
- ${ILMBASE_LIBS_IlmThread} ${ILMBASE_LIBS_Iex})
+
message (STATUS "ILMBASE_INCLUDE_AREA = ${ILMBASE_INCLUDE_AREA}")
message (STATUS "ILMBASE_LIBRARIES = ${ILMBASE_LIBRARIES}")
+
if (ILMBASE_INCLUDE_AREA AND ILMBASE_LIBRARIES)
set (ILMBASE_FOUND true)
include_directories ("${ILMBASE_INCLUDE_AREA}")
@@ -85,11 +93,19 @@
${OPENEXR_HOME}/include
${ILMBASE_HOME}/include/openexr-${OPENEXR_VERSION}
)
-find_library (OPENEXR_LIBRARY IlmImf
- PATHS ${OPENEXR_HOME}/lib
- ${OPENEXR_HOME}/lib64
- ${OPENEXR_LIB_AREA}
- )
+if (OPENEXR_CUSTOM)
+ set (OpenExr_Library ${OPENEXR_CUSTOM_LIBRARY})
+else ()
+ set (OpenExr_Library IlmImf)
+endif ()
+
+find_library (OPENEXR_LIBRARY ${OpenExr_Library}
+ PATHS ${OPENEXR_HOME}/lib
+ ${OPENEXR_HOME}/lib64
+ ${OPENEXR_LIB_AREA}
+ ${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/lib
+ )
+
message (STATUS "OPENEXR_INCLUDE_AREA = ${OPENEXR_INCLUDE_AREA}")
message (STATUS "OPENEXR_LIBRARY = ${OPENEXR_LIBRARY}")
if (OPENEXR_INCLUDE_AREA AND OPENEXR_LIBRARY)


cliffo...@...
 

The previous patch was broken. This seems to do the trick.

http://codereview.appspot.com/909042/show


larry...@...
 

LGTM. Analogous to the change in OIIO for the same purpose.


http://codereview.appspot.com/909042/show