~ubuntu-branches/ubuntu/wily/kwin/wily-proposed

« back to all changes in this revision

Viewing changes to cmake/modules/Findlibhybris.cmake

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-08-10 23:16:37 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20150810231637-5zb2tstjkez93hml
Tags: 4:5.3.95-0ubuntu1
new upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#.rst:
 
2
# Findlibhybris
 
3
# -------
 
4
#
 
5
# Try to find libhybris on a Unix system.
 
6
 
 
7
#=============================================================================
 
8
# Copyright 2015 Martin Gräßlin <mgraesslin@kde.org>
 
9
#
 
10
# Redistribution and use in source and binary forms, with or without
 
11
# modification, are permitted provided that the following conditions
 
12
# are met:
 
13
#
 
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.
 
21
#
 
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
#=============================================================================
 
33
 
 
34
if(CMAKE_VERSION VERSION_LESS 2.8.12)
 
35
    message(FATAL_ERROR "CMake 2.8.12 is required by Findlibhybris.cmake")
 
36
endif()
 
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")
 
39
endif()
 
40
 
 
41
if(NOT WIN32)
 
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)
 
51
 
 
52
    set(libhardware_DEFINITIONS ${PKG_libhardware_CFLAGS_OTHER})
 
53
    set(libhardware_VERSION ${PKG_libhardware_VERSION})
 
54
 
 
55
    find_library(libhardware_LIBRARY
 
56
        NAMES
 
57
            libhardware.so
 
58
        HINTS
 
59
            ${PKG_libhardware_LIBRARY_DIRS}
 
60
    )
 
61
    find_path(libhardware_INCLUDE_DIR
 
62
        NAMES
 
63
            android-version.h
 
64
        HINTS
 
65
            ${PKG_androidheaders_INCLUDE_DIRS}
 
66
    )
 
67
 
 
68
    include(FindPackageHandleStandardArgs)
 
69
    find_package_handle_standard_args(libhardware
 
70
        FOUND_VAR
 
71
            libhardware_FOUND
 
72
        REQUIRED_VARS
 
73
            libhardware_LIBRARY
 
74
            libhardware_INCLUDE_DIR
 
75
        VERSION_VAR
 
76
            libhardware_VERSION
 
77
    )
 
78
 
 
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}"
 
85
        )
 
86
    endif()
 
87
 
 
88
    mark_as_advanced(libhardware_LIBRARY libhardware_INCLUDE_DIR)
 
89
 
 
90
    ##############################################
 
91
    # hwcomposerWindow
 
92
    ##############################################
 
93
    set(libhwcomposer_DEFINITIONS ${PKG_hwcomposerwindow_CFLAGS_OTHER})
 
94
    set(libhwcomposer_VERSION ${PKG_hwcomposerwindow_VERSION})
 
95
 
 
96
    find_library(libhwcomposer_LIBRARY
 
97
        NAMES
 
98
            libhybris-hwcomposerwindow.so
 
99
        HINTS
 
100
            ${PKG_hwcomposerwindow_LIBRARY_DIRS}
 
101
    )
 
102
    find_path(libhwcomposer_INCLUDE_DIR
 
103
        NAMES
 
104
            hwcomposer_window.h
 
105
        HINTS
 
106
            ${PKG_hwcomposerwindow_INCLUDE_DIRS}
 
107
    )
 
108
 
 
109
    include(FindPackageHandleStandardArgs)
 
110
    find_package_handle_standard_args(libhwcomposer
 
111
        FOUND_VAR
 
112
            libhwcomposer_FOUND
 
113
        REQUIRED_VARS
 
114
            libhwcomposer_LIBRARY
 
115
            libhwcomposer_INCLUDE_DIR
 
116
        VERSION_VAR
 
117
            libhwcomposer_VERSION
 
118
    )
 
119
 
 
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}"
 
126
        )
 
127
    endif()
 
128
 
 
129
    mark_as_advanced(libhwcomposer_LIBRARY libhwcomposer_INCLUDE_DIR)
 
130
 
 
131
    ##############################################
 
132
    # hybriseglplatform
 
133
    ##############################################
 
134
    set(hybriseglplatform_DEFINITIONS ${PKG_hybriseglplatform_CFLAGS_OTHER})
 
135
    set(hybriseglplatform_VERSION ${PKG_hybriseglplatform_VERSION})
 
136
 
 
137
    find_library(hybriseglplatform_LIBRARY
 
138
        NAMES
 
139
            libhybris-eglplatformcommon.so
 
140
        HINTS
 
141
            ${PKG_hybriseglplatform_LIBRARY_DIRS}
 
142
    )
 
143
    find_path(hybriseglplatform_INCLUDE_DIR
 
144
        NAMES
 
145
            eglplatformcommon.h
 
146
        HINTS
 
147
            ${PKG_hybriseglplatform_INCLUDE_DIRS}
 
148
    )
 
149
 
 
150
    include(FindPackageHandleStandardArgs)
 
151
    find_package_handle_standard_args(hybriseglplatform
 
152
        FOUND_VAR
 
153
            hybriseglplatform_FOUND
 
154
        REQUIRED_VARS
 
155
            hybriseglplatform_LIBRARY
 
156
            hybriseglplatform_INCLUDE_DIR
 
157
        VERSION_VAR
 
158
            hybriseglplatform_VERSION
 
159
    )
 
160
 
 
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}"
 
167
        )
 
168
    endif()
 
169
 
 
170
    mark_as_advanced(hybriseglplatform_LIBRARY hybriseglplatform_INCLUDE_DIR)
 
171
 
 
172
    ##############################################
 
173
    # hybrissync
 
174
    ##############################################
 
175
    set(hybrissync_DEFINITIONS ${PKG_hybrissync_CFLAGS_OTHER})
 
176
    set(hybrissync_VERSION ${PKG_hybrissync_VERSION})
 
177
 
 
178
    find_library(hybrissync_LIBRARY
 
179
        NAMES
 
180
            libsync.so
 
181
        HINTS
 
182
            ${PKG_hybrissync_LIBRARY_DIRS}
 
183
    )
 
184
 
 
185
    include(FindPackageHandleStandardArgs)
 
186
    find_package_handle_standard_args(hybrissync
 
187
        FOUND_VAR
 
188
            hybrissync_FOUND
 
189
        REQUIRED_VARS
 
190
            hybrissync_LIBRARY
 
191
        VERSION_VAR
 
192
            hybrissync_VERSION
 
193
    )
 
194
 
 
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}"
 
200
        )
 
201
    endif()
 
202
 
 
203
    mark_as_advanced(hybrissync_LIBRARY)
 
204
 
 
205
    ##############################################
 
206
    # hybrisinputstack
 
207
    ##############################################
 
208
    set(hybrisinputstack_DEFINITIONS ${PKG_hybrisinputstack_CFLAGS_OTHER})
 
209
    set(hybrisinputstack_VERSION ${PKG_hybrisinputstack_VERSION})
 
210
 
 
211
    find_library(hybrisinputstack_LIBRARY
 
212
        NAMES
 
213
            libis.so
 
214
        HINTS
 
215
            ${PKG_hybrisinputstack_LIBRARY_DIRS}
 
216
    )
 
217
 
 
218
    include(FindPackageHandleStandardArgs)
 
219
    find_package_handle_standard_args(hybrisinputstack
 
220
        FOUND_VAR
 
221
            hybrisinputstack_FOUND
 
222
        REQUIRED_VARS
 
223
            hybrisinputstack_LIBRARY
 
224
        VERSION_VAR
 
225
            hybrisinputstack_VERSION
 
226
    )
 
227
 
 
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}"
 
233
        )
 
234
    endif()
 
235
 
 
236
    mark_as_advanced(hybrisinputstack_LIBRARY)
 
237
 
 
238
    if(libhardware_FOUND AND libhwcomposer_FOUND AND hybriseglplatform_FOUND AND hybrissync_FOUND AND hybrisinputstack_FOUND)
 
239
        set(libhybris_FOUND TRUE)
 
240
    else()
 
241
        set(libhybris_FOUND FALSE)
 
242
    endif()
 
243
 
 
244
else()
 
245
    message(STATUS "Findlibhardware.cmake cannot find libhybris on Windows systems.")
 
246
    set(libhybris_FOUND FALSE)
 
247
endif()
 
248
 
 
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."
 
253
)