1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# - Find the native HEIF includes and library
#
# This module defines
# HEIF_INCLUDE_DIR, where to find heif.h, etc.
# HEIF_LIBRARIES, the libraries to link against to use HEIF.
# HEIF_FOUND, If false, do not try to use HEIF.
# Also defined, but not for general use are
# HEIF_LIBRARY, where to find the HEIF library.
# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * The names of Kitware, Inc., the Insight Consortium, or the names of
# any consortium members, or of any contributors, may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SET(HEIF_FOUND "NO")
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if( NOT WIN32 )
find_package(PkgConfig)
pkg_check_modules(HEIF_PKG libheif>=1.7.0 QUIET)
endif( NOT WIN32 )
FIND_PATH(HEIF_INCLUDE_DIR NAMES libheif/heif.h
PATHS
/usr/local/include
/usr/include
HINTS
${HEIF_PKG_INCLUDE_DIRS} # Generated by pkg-config
)
IF (NOT HEIF_PKG_FOUND)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES(
"
#include <libheif/heif.h>
#if !LIBHEIF_HAVE_VERSION(1, 7, 0)
#error \"libheif version is too old\"
#endif
int main() { return 0; }
"
HEIF_HDR_TO_8BIT
)
ENDIF (NOT HEIF_PKG_FOUND)
IF (NOT HEIF_HDR_TO_8BIT AND NOT HEIF_PKG_FOUND)
MESSAGE(FATAL_ERROR "libheif version found is too old")
ENDIF (NOT HEIF_HDR_TO_8BIT AND NOT HEIF_PKG_FOUND)
SET(HEIF_NAMES ${HEIF_NAMES} heif ${HEIF_PKG_LIBRARY})
FIND_LIBRARY(HEIF_LIBRARY
NAMES ${HEIF_NAMES}
PATH /usr/local/lib /usr/lib
PATH_SUFFIXES lib64 lib
HINTS ${HEIF_PKG_LIBRARY_DIRS} # Generated by pkg-config
)
IF (HEIF_LIBRARY AND HEIF_INCLUDE_DIR)
SET(HEIF_FOUND "YES")
SET(HAVE_LIBHEIF 1)
SET(HEIF_LIBRARIES ${HEIF_LIBRARY})
ENDIF (HEIF_LIBRARY AND HEIF_INCLUDE_DIR)
IF (HEIF_FOUND)
IF (NOT HEIF_FIND_QUIETLY)
MESSAGE(STATUS "Find HEIF: ${HEIF_LIBRARY}")
ENDIF (NOT HEIF_FIND_QUIETLY)
ELSE (HEIF_FOUND)
IF (HEIF_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find HEIF library")
ENDIF (HEIF_FIND_REQUIRED)
ENDIF (HEIF_FOUND)
MARK_AS_ADVANCED(HEIF_INCLUDE_DIR HEIF_LIBRARY)
|