diff options
Diffstat (limited to 'cmake/modules/FindWaylandpp.cmake')
| -rw-r--r-- | cmake/modules/FindWaylandpp.cmake | 73 |
1 files changed, 24 insertions, 49 deletions
diff --git a/cmake/modules/FindWaylandpp.cmake b/cmake/modules/FindWaylandpp.cmake index 8a1cd74..336e613 100644 --- a/cmake/modules/FindWaylandpp.cmake +++ b/cmake/modules/FindWaylandpp.cmake | |||
| @@ -1,64 +1,39 @@ | |||
| 1 | # FindWaylandpp | 1 | # FindWaylandpp |
| 2 | # ----------- | 2 | # ------------- |
| 3 | # Finds the waylandpp library | 3 | # Finds the waylandpp library |
| 4 | # | 4 | # |
| 5 | # This will will define the following variables:: | 5 | # This will will define the following variables:: |
| 6 | # | 6 | # |
| 7 | # WAYLANDPP_FOUND - the system has Wayland | 7 | # WAYLANDPP_FOUND - the system has waylandpp |
| 8 | # WAYLANDPP_INCLUDE_DIRS - the Wayland include directory | 8 | # WAYLANDPP_INCLUDE_DIRS - the waylandpp include directory |
| 9 | # WAYLANDPP_LIBRARIES - the Wayland libraries | 9 | # WAYLANDPP_LIBRARIES - the waylandpp libraries |
| 10 | # WAYLANDPP_DEFINITIONS - the Wayland definitions | 10 | # WAYLANDPP_DEFINITIONS - the waylandpp definitions |
| 11 | 11 | # WAYLANDPP_SCANNER - path to wayland-scanner++ | |
| 12 | 12 | ||
| 13 | if(PKG_CONFIG_FOUND) | 13 | pkg_check_modules(WAYLANDPP wayland-client++ wayland-egl++ wayland-cursor++) |
| 14 | pkg_check_modules(PC_WAYLANDPP wayland-client++>=0.1 wayland-egl++ wayland-cursor++ wayland-scanner++ QUIET) | 14 | pkg_check_modules(PC_WAYLANDPP_SCANNER wayland-scanner++) |
| 15 | pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols>=1.7 QUIET) | 15 | if(WAYLANDPP_FOUND) |
| 16 | # TODO: Remove check when CMake minimum version is bumped globally | 16 | pkg_get_variable(PC_WAYLANDPP_PKGDATADIR wayland-client++ pkgdatadir) |
| 17 | if(CMAKE_VERSION VERSION_EQUAL 3.4.0 OR CMAKE_VERSION VERSION_GREATER 3.4.0) | 17 | endif() |
| 18 | if(PC_WAYLANDPP_FOUND) | 18 | if(PC_WAYLANDPP_SCANNER_FOUND) |
| 19 | pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) | 19 | pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) |
| 20 | endif() | ||
| 21 | if(PC_WAYLAND_PROTOCOLS_FOUND) | ||
| 22 | pkg_get_variable(PC_WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) | ||
| 23 | endif() | ||
| 24 | endif() | ||
| 25 | endif() | 20 | endif() |
| 26 | 21 | ||
| 27 | find_path(WAYLANDPP_INCLUDE_DIR NAMES wayland-client.hpp | 22 | # Promote to cache variables so all code can access it |
| 28 | PATHS ${PC_WAYLANDPP_INCLUDE_DIRS}) | 23 | set(WAYLANDPP_PROTOCOLS_DIR "${PC_WAYLANDPP_PKGDATADIR}/protocols" CACHE INTERNAL "") |
| 29 | |||
| 30 | find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++ | ||
| 31 | PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) | ||
| 32 | |||
| 33 | find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++ | ||
| 34 | PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) | ||
| 35 | |||
| 36 | find_library(WAYLANDPP_EGL_LIBRARY NAMES wayland-egl++ | ||
| 37 | PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) | ||
| 38 | |||
| 39 | find_program(WAYLANDPP_SCANNER NAMES wayland-scanner++ | ||
| 40 | PATHS ${PC_WAYLANDPP_SCANNER}) | ||
| 41 | 24 | ||
| 42 | find_path(WAYLAND_PROTOCOLS_DIR NAMES unstable/xdg-shell/xdg-shell-unstable-v6.xml | 25 | # wayland-scanner++ is from native/host system in case of cross-compilation, so |
| 43 | PATHS ${PC_WAYLAND_PROTOCOLS_DIR} | 26 | # it's ok if we don't find it with pkgconfig |
| 44 | DOC "Directory containing additional Wayland protocols") | 27 | find_program(WAYLANDPP_SCANNER wayland-scanner++ PATHS ${PC_WAYLANDPP_SCANNER}) |
| 45 | 28 | ||
| 46 | include (FindPackageHandleStandardArgs) | 29 | include (FindPackageHandleStandardArgs) |
| 47 | find_package_handle_standard_args (Waylandpp | 30 | find_package_handle_standard_args (Waylandpp |
| 48 | REQUIRED_VARS | 31 | REQUIRED_VARS |
| 49 | WAYLANDPP_INCLUDE_DIR | 32 | WAYLANDPP_FOUND |
| 50 | WAYLANDPP_CLIENT_LIBRARY | ||
| 51 | WAYLANDPP_CURSOR_LIBRARY | ||
| 52 | WAYLANDPP_EGL_LIBRARY | ||
| 53 | WAYLANDPP_SCANNER | 33 | WAYLANDPP_SCANNER |
| 54 | WAYLAND_PROTOCOLS_DIR | ||
| 55 | VERSION_VAR | 34 | VERSION_VAR |
| 56 | PC_WAYLANDPP_wayland-client++_VERSION) | 35 | WAYLANDPP_wayland-client++_VERSION) |
| 57 | |||
| 58 | if (WAYLANDPP_FOUND) | ||
| 59 | set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY} ${WAYLANDPP_CURSOR_LIBRARY} ${WAYLANDPP_EGL_LIBRARY}) | ||
| 60 | set(WAYLANDPP_INCLUDE_DIRS ${PC_WAYLANDPP_INCLUDE_DIRS}) | ||
| 61 | set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) | ||
| 62 | endif() | ||
| 63 | 36 | ||
| 64 | mark_as_advanced (WAYLANDPP_CLIENT_LIBRARY WAYLANDPP_CURSOR_LIBRARY WAYLANDPP_EGL_LIBRARY WAYLANDPP_INCLUDE_DIR) | 37 | set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) |
| 38 | # Also pass on library directories | ||
| 39 | set(WAYLANDPP_LIBRARIES ${WAYLANDPP_LDFLAGS}) | ||
