5
# Try to find libhybris on a Unix system.
7
#=============================================================================
8
# Copyright 2015 Martin Gräßlin <mgraesslin@kde.org>
10
# Redistribution and use in source and binary forms, with or without
11
# modification, are permitted provided that the following conditions
14
# 1. Redistributions of source code must retain the copyright
15
# notice, this list of conditions and the following disclaimer.
16
# 2. Redistributions in binary form must reproduce the copyright
17
# notice, this list of conditions and the following disclaimer in the
18
# documentation and/or other materials provided with the distribution.
19
# 3. The name of the author may not be used to endorse or promote products
20
# derived from this software without specific prior written permission.
22
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
#=============================================================================
34
if(CMAKE_VERSION VERSION_LESS 2.8.12)
35
message(FATAL_ERROR "CMake 2.8.12 is required by Findlibhybris.cmake")
37
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
38
message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findlibhybris.cmake")
42
# Use pkg-config to get the directories and then use these values
43
# in the FIND_PATH() and FIND_LIBRARY() calls
44
find_package(PkgConfig)
45
pkg_check_modules(PKG_libhardware QUIET libhardware)
46
pkg_check_modules(PKG_androidheaders QUIET android-headers)
47
pkg_check_modules(PKG_hwcomposerwindow QUIET hwcomposer-egl)
48
pkg_check_modules(PKG_hybriseglplatform QUIET hybris-egl-platform)
49
pkg_check_modules(PKG_hybrissync QUIET libsync)
50
pkg_check_modules(PKG_hybrisinputstack QUIET libis)
52
set(libhardware_DEFINITIONS ${PKG_libhardware_CFLAGS_OTHER})
53
set(libhardware_VERSION ${PKG_libhardware_VERSION})
55
find_library(libhardware_LIBRARY
59
${PKG_libhardware_LIBRARY_DIRS}
61
find_path(libhardware_INCLUDE_DIR
65
${PKG_androidheaders_INCLUDE_DIRS}
68
include(FindPackageHandleStandardArgs)
69
find_package_handle_standard_args(libhardware
74
libhardware_INCLUDE_DIR
79
if(libhardware_FOUND AND NOT TARGET libhybris::libhardware)
80
add_library(libhybris::libhardware UNKNOWN IMPORTED)
81
set_target_properties(libhybris::libhardware PROPERTIES
82
IMPORTED_LOCATION "${libhardware_LIBRARY}"
83
INTERFACE_COMPILE_OPTIONS "${libhardware_DEFINITIONS}"
84
INTERFACE_INCLUDE_DIRECTORIES "${libhardware_INCLUDE_DIR}"
88
mark_as_advanced(libhardware_LIBRARY libhardware_INCLUDE_DIR)
90
##############################################
92
##############################################
93
set(libhwcomposer_DEFINITIONS ${PKG_hwcomposerwindow_CFLAGS_OTHER})
94
set(libhwcomposer_VERSION ${PKG_hwcomposerwindow_VERSION})
96
find_library(libhwcomposer_LIBRARY
98
libhybris-hwcomposerwindow.so
100
${PKG_hwcomposerwindow_LIBRARY_DIRS}
102
find_path(libhwcomposer_INCLUDE_DIR
106
${PKG_hwcomposerwindow_INCLUDE_DIRS}
109
include(FindPackageHandleStandardArgs)
110
find_package_handle_standard_args(libhwcomposer
114
libhwcomposer_LIBRARY
115
libhwcomposer_INCLUDE_DIR
117
libhwcomposer_VERSION
120
if(libhwcomposer_FOUND AND NOT TARGET libhybris::hwcomposer)
121
add_library(libhybris::hwcomposer UNKNOWN IMPORTED)
122
set_target_properties(libhybris::hwcomposer PROPERTIES
123
IMPORTED_LOCATION "${libhwcomposer_LIBRARY}"
124
INTERFACE_COMPILE_OPTIONS "${libhardware_DEFINITIONS}"
125
INTERFACE_INCLUDE_DIRECTORIES "${libhwcomposer_INCLUDE_DIR}"
129
mark_as_advanced(libhwcomposer_LIBRARY libhwcomposer_INCLUDE_DIR)
131
##############################################
133
##############################################
134
set(hybriseglplatform_DEFINITIONS ${PKG_hybriseglplatform_CFLAGS_OTHER})
135
set(hybriseglplatform_VERSION ${PKG_hybriseglplatform_VERSION})
137
find_library(hybriseglplatform_LIBRARY
139
libhybris-eglplatformcommon.so
141
${PKG_hybriseglplatform_LIBRARY_DIRS}
143
find_path(hybriseglplatform_INCLUDE_DIR
147
${PKG_hybriseglplatform_INCLUDE_DIRS}
150
include(FindPackageHandleStandardArgs)
151
find_package_handle_standard_args(hybriseglplatform
153
hybriseglplatform_FOUND
155
hybriseglplatform_LIBRARY
156
hybriseglplatform_INCLUDE_DIR
158
hybriseglplatform_VERSION
161
if(hybriseglplatform_FOUND AND NOT TARGET libhybris::hybriseglplatform)
162
add_library(libhybris::hybriseglplatform UNKNOWN IMPORTED)
163
set_target_properties(libhybris::hybriseglplatform PROPERTIES
164
IMPORTED_LOCATION "${hybriseglplatform_LIBRARY}"
165
INTERFACE_COMPILE_OPTIONS "${hybriseglplatform_DEFINITIONS}"
166
INTERFACE_INCLUDE_DIRECTORIES "${hybriseglplatform_INCLUDE_DIR}"
170
mark_as_advanced(hybriseglplatform_LIBRARY hybriseglplatform_INCLUDE_DIR)
172
##############################################
174
##############################################
175
set(hybrissync_DEFINITIONS ${PKG_hybrissync_CFLAGS_OTHER})
176
set(hybrissync_VERSION ${PKG_hybrissync_VERSION})
178
find_library(hybrissync_LIBRARY
182
${PKG_hybrissync_LIBRARY_DIRS}
185
include(FindPackageHandleStandardArgs)
186
find_package_handle_standard_args(hybrissync
195
if(hybrissync_FOUND AND NOT TARGET libhybris::sync)
196
add_library(libhybris::sync UNKNOWN IMPORTED)
197
set_target_properties(libhybris::sync PROPERTIES
198
IMPORTED_LOCATION "${hybrissync_LIBRARY}"
199
INTERFACE_COMPILE_OPTIONS "${hybrissync_DEFINITIONS}"
203
mark_as_advanced(hybrissync_LIBRARY)
205
##############################################
207
##############################################
208
set(hybrisinputstack_DEFINITIONS ${PKG_hybrisinputstack_CFLAGS_OTHER})
209
set(hybrisinputstack_VERSION ${PKG_hybrisinputstack_VERSION})
211
find_library(hybrisinputstack_LIBRARY
215
${PKG_hybrisinputstack_LIBRARY_DIRS}
218
include(FindPackageHandleStandardArgs)
219
find_package_handle_standard_args(hybrisinputstack
221
hybrisinputstack_FOUND
223
hybrisinputstack_LIBRARY
225
hybrisinputstack_VERSION
228
if(hybrisinputstack_FOUND AND NOT TARGET libhybris::inputstack)
229
add_library(libhybris::inputstack UNKNOWN IMPORTED)
230
set_target_properties(libhybris::inputstack PROPERTIES
231
IMPORTED_LOCATION "${hybrisinputstack_LIBRARY}"
232
INTERFACE_COMPILE_OPTIONS "${hybrisinputstack_DEFINITIONS}"
236
mark_as_advanced(hybrisinputstack_LIBRARY)
238
if(libhardware_FOUND AND libhwcomposer_FOUND AND hybriseglplatform_FOUND AND hybrissync_FOUND AND hybrisinputstack_FOUND)
239
set(libhybris_FOUND TRUE)
241
set(libhybris_FOUND FALSE)
245
message(STATUS "Findlibhardware.cmake cannot find libhybris on Windows systems.")
246
set(libhybris_FOUND FALSE)
249
include(FeatureSummary)
250
set_package_properties(libhybris PROPERTIES
251
URL "https://github.com/libhybris/libhybris"
252
DESCRIPTION "libhybris allows to run bionic-based HW adaptations in glibc systems."