aboutsummaryrefslogtreecommitdiff
path: root/CMake/FindWayland.cmake
blob: 465d2665ed56b7b5bf7274c9b5972a6f747b5751 (plain)
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
#.rst:
# FindWayland
# -----------
#
# Find Wayland installation
#
# Try to find Wayland. The following values are defined
#
# ::
#
#   WAYLAND_FOUND        - True if Wayland is found
#   WAYLAND_LIBRARIES    - Link these to use Wayland
#   WAYLAND_INCLUDE_DIRS - Include directories for Wayland
#   WAYLAND_DEFINITIONS  - Compiler flags for using Wayland
#
# and also the following more fine grained variables:
#
# ::
#
#   WAYLAND_CLIENT_FOUND,  WAYLAND_CLIENT_INCLUDE_DIRS,  WAYLAND_CLIENT_LIBRARIES
#   WAYLAND_SERVER_FOUND,  WAYLAND_SERVER_INCLUDE_DIRS,  WAYLAND_SERVER_LIBRARIES
#   WAYLAND_EGL_FOUND,     WAYLAND_EGL_INCLUDE_DIRS,     WAYLAND_EGL_LIBRARIES
#
#=============================================================================
# Copyright (c) 2015 Jari Vetoniemi
#               2013 Martin Gräßlin <mgraesslin@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================

include(FeatureSummary)
set_package_properties(Wayland PROPERTIES
   URL "http://wayland.freedesktop.org/"
   DESCRIPTION "Protocol for implementing compositors")

find_package(PkgConfig)
pkg_check_modules(PC_WAYLAND QUIET wayland-client>=1.7 wayland-server>=1.7 wayland-egl)

find_library(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client   HINTS ${PC_WAYLAND_LIBRARY_DIRS})
find_library(WAYLAND_SERVER_LIBRARIES NAMES wayland-server   HINTS ${PC_WAYLAND_LIBRARY_DIRS})
find_library(WAYLAND_EGL_LIBRARIES    NAMES wayland-egl      HINTS ${PC_WAYLAND_LIBRARY_DIRS})

find_path(WAYLAND_CLIENT_INCLUDE_DIRS  NAMES wayland-client.h HINTS ${PC_WAYLAND_INCLUDE_DIRS})
find_path(WAYLAND_SERVER_INCLUDE_DIRS  NAMES wayland-server.h HINTS ${PC_WAYLAND_INCLUDE_DIRS})
find_path(WAYLAND_EGL_INCLUDE_DIRS     NAMES wayland-egl.h    HINTS ${PC_WAYLAND_INCLUDE_DIRS})

set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIRS} ${WAYLAND_SERVER_INCLUDE_DIRS} ${WAYLAND_EGL_INCLUDE_DIRS})
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
set(WAYLAND_DEFINITIONS ${PC_WAYLAND_CFLAGS})

list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WAYLAND_CLIENT  DEFAULT_MSG  WAYLAND_CLIENT_LIBRARIES  WAYLAND_CLIENT_INCLUDE_DIRS)
find_package_handle_standard_args(WAYLAND_SERVER  DEFAULT_MSG  WAYLAND_SERVER_LIBRARIES  WAYLAND_SERVER_INCLUDE_DIRS)
find_package_handle_standard_args(WAYLAND_EGL     DEFAULT_MSG  WAYLAND_EGL_LIBRARIES     WAYLAND_EGL_INCLUDE_DIRS)
find_package_handle_standard_args(WAYLAND         DEFAULT_MSG  WAYLAND_LIBRARIES         WAYLAND_INCLUDE_DIRS)

mark_as_advanced(
  WAYLAND_INCLUDE_DIRS         WAYLAND_LIBRARIES
  WAYLAND_CLIENT_INCLUDE_DIRS  WAYLAND_CLIENT_LIBRARIES
  WAYLAND_SERVER_INCLUDE_DIRS  WAYLAND_SERVER_LIBRARIES
  WAYLAND_EGL_INCLUDE_DIRS     WAYLAND_EGL_LIBRARIES
  WAYLAND_DEFINITIONS
  )