Cleanup: move check_drag & check_click out of wmEvent
[blender.git] / build_files / cmake / Modules / FindOpenImageIO.cmake
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 #=============================================================================
17 # Copyright 2011 Blender Foundation.
18 #
19 # Distributed under the OSI-approved BSD 3-Clause License,
20 # see accompanying file BSD-3-Clause-license.txt for details.
21 #=============================================================================
22
23 # If OPENIMAGEIO_ROOT_DIR was defined in the environment, use it.
24 IF(NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "")
25   SET(OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR})
26 ENDIF()
27
28 SET(_openimageio_SEARCH_DIRS
29   ${OPENIMAGEIO_ROOT_DIR}
30   /opt/lib/oiio
31 )
32
33 FIND_PATH(OPENIMAGEIO_INCLUDE_DIR
34   NAMES
35     OpenImageIO/imageio.h
36   HINTS
37     ${_openimageio_SEARCH_DIRS}
38   PATH_SUFFIXES
39     include
40 )
41
42 FIND_LIBRARY(OPENIMAGEIO_LIBRARY
43   NAMES
44     OpenImageIO
45   HINTS
46     ${_openimageio_SEARCH_DIRS}
47   PATH_SUFFIXES
48     lib64 lib
49   )
50
51 FIND_FILE(OPENIMAGEIO_IDIFF
52   NAMES
53     idiff
54   HINTS
55     ${_openimageio_SEARCH_DIRS}
56   PATH_SUFFIXES
57     bin
58 )
59
60 # handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
61 # all listed variables are TRUE
62 INCLUDE(FindPackageHandleStandardArgs)
63 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
64     OPENIMAGEIO_LIBRARY OPENIMAGEIO_INCLUDE_DIR)
65
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
78 MARK_AS_ADVANCED(
79   OPENIMAGEIO_INCLUDE_DIR
80   OPENIMAGEIO_LIBRARY
81   OPENIMAGEIO_IDIFF
82 )
83
84 UNSET(_openimageio_SEARCH_DIRS)