File: FindWaylandpp.cmake

package info (click to toggle)
kodi 2%3A21.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 143,076 kB
  • sloc: cpp: 694,471; xml: 52,618; ansic: 38,300; python: 7,161; sh: 4,289; javascript: 2,325; makefile: 1,791; perl: 969; java: 513; cs: 390; objc: 340
file content (98 lines) | stat: -rw-r--r-- 3,960 bytes parent folder | download | duplicates (2)
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
# FindWaylandpp
# -------------
# Finds the waylandpp library
#
# This will define the following variables::
#
# WAYLANDPP_FOUND        - the system has waylandpp
# WAYLANDPP_INCLUDE_DIRS - the waylandpp include directory
# WAYLANDPP_LIBRARIES    - the waylandpp libraries
# WAYLANDPP_DEFINITIONS  - the waylandpp definitions
# WAYLANDPP_SCANNER      - path to wayland-scanner++

pkg_check_modules(PC_WAYLANDPP wayland-client++ wayland-egl++ wayland-cursor++ QUIET)

if(PC_WAYLANDPP_FOUND)
  pkg_get_variable(PC_WAYLANDPP_PKGDATADIR wayland-client++ pkgdatadir)
else()
  message(SEND_ERROR "wayland-client++ not found via pkg-config")
endif()

pkg_check_modules(PC_WAYLANDPP_SCANNER wayland-scanner++ QUIET)

if(PC_WAYLANDPP_SCANNER_FOUND)
  pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp)
else()
  message(SEND_ERROR "wayland-scanner++ not found via pkg-config")
endif()

find_path(WAYLANDPP_INCLUDE_DIR wayland-client.hpp PATHS ${PC_WAYLANDPP_INCLUDEDIR})

find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++
                                      PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})

find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++
                                      PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})

find_library(WAYLANDPP_EGL_LIBRARY NAMES wayland-egl++
                                   PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})

if(KODI_DEPENDSBUILD)
  pkg_check_modules(PC_WAYLANDC wayland-client wayland-egl wayland-cursor QUIET)

  if(PREFER_TOOLCHAIN_PATH)
    set(WAYLAND_SEARCH_PATH ${PREFER_TOOLCHAIN_PATH}
                            NO_DEFAULT_PATH
                            PATH_SUFFIXES usr/lib)
  else()
    set(WAYLAND_SEARCH_PATH ${PC_WAYLANDC_LIBRARY_DIRS})
  endif()

  find_library(WAYLANDC_CLIENT_LIBRARY NAMES wayland-client
                                       PATHS ${WAYLAND_SEARCH_PATH}
                                       REQUIRED)
  find_library(WAYLANDC_CURSOR_LIBRARY NAMES wayland-cursor
                                       PATHS ${WAYLAND_SEARCH_PATH}
                                       REQUIRED)
  find_library(WAYLANDC_EGL_LIBRARY NAMES wayland-egl
                                    PATHS ${WAYLAND_SEARCH_PATH}
                                    REQUIRED)

  set(WAYLANDPP_STATIC_DEPS ${WAYLANDC_CLIENT_LIBRARY}
                            ${WAYLANDC_CURSOR_LIBRARY}
                            ${WAYLANDC_EGL_LIBRARY})
endif()

# Promote to cache variables so all code can access it
set(WAYLANDPP_PROTOCOLS_DIR "${PC_WAYLANDPP_PKGDATADIR}/protocols" CACHE INTERNAL "")

# wayland-scanner++ is from native/host system in case of cross-compilation, so
# it's ok if we don't find it with pkgconfig
find_program(WAYLANDPP_SCANNER wayland-scanner++ PATHS ${PC_WAYLANDPP_SCANNER})

include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(Waylandpp
                                  REQUIRED_VARS WAYLANDPP_INCLUDE_DIR
                                                WAYLANDPP_CLIENT_LIBRARY
                                                WAYLANDPP_CURSOR_LIBRARY
                                                WAYLANDPP_EGL_LIBRARY
                                                WAYLANDPP_SCANNER
                                  VERSION_VAR WAYLANDPP_wayland-client++_VERSION)

if(WAYLANDPP_FOUND)
  set(WAYLANDPP_INCLUDE_DIRS ${WAYLANDPP_INCLUDE_DIR})
  set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY}
                          ${WAYLANDPP_CURSOR_LIBRARY}
                          ${WAYLANDPP_EGL_LIBRARY}
                          ${WAYLANDPP_STATIC_DEPS})
  set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1)
endif()

mark_as_advanced(WAYLANDPP_INCLUDE_DIR
                 WAYLANDPP_CLIENT_LIBRARY
                 WAYLANDC_CLIENT_LIBRARY
                 WAYLANDPP_CURSOR_LIBRARY
                 WAYLANDC_CURSOR_LIBRARY
                 WAYLANDPP_EGL_LIBRARY
                 WAYLANDC_EGL_LIBRARY
                 WAYLANDPP_SCANNER)