diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-08-29 19:59:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-29 20:51:07 +0300 |
commit | 7fbf72f148dc9eada86cfcb345310c98f76962b8 (patch) | |
tree | d8d587a687f09c25b0847ad87abb809d73bf7209 /build_files | |
parent | 74caf773619bbf6a0f95c598b66261a6bef392ee (diff) |
Build: automatically disable WITH_GHOST_WAYLAND if missing libraries
Same as other build options, don't make it a hard requirement to have
Wayland libraries installed when it gets enabled by default.
Also fixes wayland-protocols not being found on the buildbot.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 98 |
1 files changed, 72 insertions, 26 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 080cbfd6a16..c321da80649 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -653,46 +653,92 @@ endif() if(WITH_GHOST_WAYLAND) find_package(PkgConfig) - pkg_check_modules(wayland-client REQUIRED wayland-client>=1.12) - pkg_check_modules(wayland-egl REQUIRED wayland-egl) - pkg_check_modules(wayland-scanner REQUIRED wayland-scanner) - pkg_check_modules(xkbcommon REQUIRED xkbcommon) - pkg_check_modules(wayland-cursor REQUIRED wayland-cursor) + pkg_check_modules(wayland-client wayland-client>=1.12) + pkg_check_modules(wayland-egl wayland-egl) + pkg_check_modules(wayland-scanner wayland-scanner) + pkg_check_modules(xkbcommon xkbcommon) + pkg_check_modules(wayland-cursor wayland-cursor) + pkg_check_modules(wayland-protocols wayland-protocols>=1.15) + + if(${wayland-protocols_FOUND}) + pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) + else() + # CentOS 7 packages have too old a version, a newer version exist in the + # precompiled libraries. + find_path(WAYLAND_PROTOCOLS_DIR + NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml + PATH_SUFFIXES share/wayland-protocols + PATHS ${LIBDIR}/wayland-protocols + ) - if(WITH_GHOST_WAYLAND_DBUS) - pkg_check_modules(dbus REQUIRED dbus-1) + if(EXISTS ${WAYLAND_PROTOCOLS_DIR}) + set(wayland-protocols_FOUND ON) + endif() endif() - if(WITH_GHOST_WAYLAND_LIBDECOR) - pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1) + if (NOT ${wayland-client_FOUND}) + message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-egl_FOUND}) + message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-scanner_FOUND}) + message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-cursor_FOUND}) + message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-protocols_FOUND}) + message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${xkbcommon_FOUND}) + message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) endif() - list(APPEND PLATFORM_LINKLIBS - ${xkbcommon_LINK_LIBRARIES} - ) + if(WITH_GHOST_WAYLAND) + if(WITH_GHOST_WAYLAND_DBUS) + pkg_check_modules(dbus REQUIRED dbus-1) + endif() - if(NOT WITH_GHOST_WAYLAND_DYNLOAD) - list(APPEND PLATFORM_LINKLIBS - ${wayland-client_LINK_LIBRARIES} - ${wayland-egl_LINK_LIBRARIES} - ${wayland-cursor_LINK_LIBRARIES} - ) - endif() + if(WITH_GHOST_WAYLAND_LIBDECOR) + pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1) + endif() - if(WITH_GHOST_WAYLAND_DBUS) list(APPEND PLATFORM_LINKLIBS - ${dbus_LINK_LIBRARIES} + ${xkbcommon_LINK_LIBRARIES} ) - add_definitions(-DWITH_GHOST_WAYLAND_DBUS) - endif() - if(WITH_GHOST_WAYLAND_LIBDECOR) if(NOT WITH_GHOST_WAYLAND_DYNLOAD) list(APPEND PLATFORM_LINKLIBS - ${libdecor_LIBRARIES} + ${wayland-client_LINK_LIBRARIES} + ${wayland-egl_LINK_LIBRARIES} + ${wayland-cursor_LINK_LIBRARIES} + ) + endif() + + if(WITH_GHOST_WAYLAND_DBUS) + list(APPEND PLATFORM_LINKLIBS + ${dbus_LINK_LIBRARIES} ) + add_definitions(-DWITH_GHOST_WAYLAND_DBUS) + endif() + + if(WITH_GHOST_WAYLAND_LIBDECOR) + if(NOT WITH_GHOST_WAYLAND_DYNLOAD) + list(APPEND PLATFORM_LINKLIBS + ${libdecor_LIBRARIES} + ) + endif() + add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR) endif() - add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR) + + pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner) endif() endif() |