Build: add wayland to deps build

This is needed to ensure and up to date "wayland-scanner" is used,
as versions before 1.20.0 generate headers incompatible with
dynamic linking (WITH_GHOST_WAYLAND_DYNLOAD).

As the centos7 version of wayland is 1.15 so make this part of Blender's
dependencies on Linux.

We intend to enable Wayland for Blender 3.4 release, this is needed for
the build-bot.

Reviewed By: brecht

Ref D16074
This commit is contained in:
Campbell Barton 2022-09-27 11:54:35 +10:00
parent 5f6d66c1c5
commit cbab734445
6 changed files with 33 additions and 1 deletions

View File

@ -170,6 +170,8 @@ if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
# Can be removed when the build-bot upgrades to v1.20.x or newer.
include(cmake/wayland.cmake)
endif()
include(cmake/harvest.cmake)

View File

@ -89,6 +89,7 @@ download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(WAYLAND)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)

View File

@ -117,6 +117,7 @@ else()
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
harvest(wayland/bin wayland/bin "wayland-scanner")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")

View File

@ -458,6 +458,12 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(WAYLAND_VERSION 1.21.0)
set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_URI https://wayland.freedesktop.org/releases/wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
set(WAYLAND_HASH_TYPE MD5)
set(ISPC_VERSION v1.17.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)

View File

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_wayland
URL file://${PACKAGE_DIR}/${WAYLAND_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
PREFIX ${BUILD_DIR}/wayland
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig
meson --prefix ${LIBDIR}/wayland . ../external_wayland
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
add_dependencies(
external_wayland
external_expat
)

View File

@ -764,7 +764,11 @@ if(WITH_GHOST_WAYLAND)
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
endif()
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
if(EXISTS "${LIBDIR}/wayland/bin/wayland-scanner")
set(WAYLAND_SCANNER "${LIBDIR}/wayland/bin/wayland-scanner")
else()
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
endif()
# When using dynamic loading, headers generated
# from older versions of `wayland-scanner` aren't compatible.