FindOpenImageIO.cmake 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # - Find OpenImageIO library
  2. # Find the native OpenImageIO includes and library
  3. # This module defines
  4. # OPENIMAGEIO_INCLUDE_DIRS, where to find openimageio.h, Set when
  5. # OPENIMAGEIO_INCLUDE_DIR is found.
  6. # OPENIMAGEIO_LIBRARIES, libraries to link against to use OpenImageIO.
  7. # OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
  8. # This can also be an environment variable.
  9. # OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
  10. # OPENIMAGEIO_PUGIXML_FOUND, Indicates whether OIIO has biltin PuguXML parser.
  11. # OPENIMAGEIO_IDIFF, full path to idiff application if found.
  12. #
  13. # also defined, but not for general use are
  14. # OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
  15. #=============================================================================
  16. # Copyright 2011 Blender Foundation.
  17. #
  18. # Distributed under the OSI-approved BSD License (the "License");
  19. # see accompanying file Copyright.txt for details.
  20. #
  21. # This software is distributed WITHOUT ANY WARRANTY; without even the
  22. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. # See the License for more information.
  24. #=============================================================================
  25. # If OPENIMAGEIO_ROOT_DIR was defined in the environment, use it.
  26. IF(NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "")
  27. SET(OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR})
  28. ENDIF()
  29. SET(_openimageio_SEARCH_DIRS
  30. ${OPENIMAGEIO_ROOT_DIR}
  31. /usr/local
  32. /sw # Fink
  33. /opt/local # DarwinPorts
  34. /opt/csw # Blastwave
  35. /opt/lib/oiio
  36. )
  37. FIND_PATH(OPENIMAGEIO_INCLUDE_DIR
  38. NAMES
  39. OpenImageIO/imageio.h
  40. HINTS
  41. ${_openimageio_SEARCH_DIRS}
  42. PATH_SUFFIXES
  43. include
  44. )
  45. FIND_LIBRARY(OPENIMAGEIO_LIBRARY
  46. NAMES
  47. OpenImageIO
  48. HINTS
  49. ${_openimageio_SEARCH_DIRS}
  50. PATH_SUFFIXES
  51. lib64 lib
  52. )
  53. FIND_FILE(OPENIMAGEIO_IDIFF
  54. NAMES
  55. idiff
  56. HINTS
  57. ${_openimageio_SEARCH_DIRS}
  58. PATH_SUFFIXES
  59. bin
  60. )
  61. # handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
  62. # all listed variables are TRUE
  63. INCLUDE(FindPackageHandleStandardArgs)
  64. FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
  65. OPENIMAGEIO_LIBRARY OPENIMAGEIO_INCLUDE_DIR)
  66. IF(OPENIMAGEIO_FOUND)
  67. SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
  68. SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
  69. IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp)
  70. SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
  71. ELSE()
  72. SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
  73. ENDIF()
  74. ELSE()
  75. SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
  76. ENDIF()
  77. MARK_AS_ADVANCED(
  78. OPENIMAGEIO_INCLUDE_DIR
  79. OPENIMAGEIO_LIBRARY
  80. OPENIMAGEIO_IDIFF
  81. )
  82. UNSET(_openimageio_SEARCH_DIRS)