[vlc-commits] [Git][videolan/vlc][master] meson: wayland: add build system support

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat May 30 12:40:55 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
6f539a61 by Ahmed Sobhy at 2026-05-30T14:28:34+02:00
meson: wayland: add build system support

- - - - -


3 changed files:

- modules/gui/qt/meson.build
- modules/video_output/meson.build
- + modules/video_output/wayland/meson.build


Changes:

=====================================
modules/gui/qt/meson.build
=====================================
@@ -188,6 +188,10 @@ if (x11_dep.found() and
     )
 endif
 
+if have_wayland and cpp.has_header('qpa/qplatformnativeinterface.h', dependencies: qt6_dep)
+    moc_headers += files('maininterface/compositor_wayland.hpp')
+endif
+
 qt_plugin_sources = files(
     'qt.cpp',
     'qt.hpp',
@@ -551,6 +555,12 @@ if (x11_dep.found() and
     )
 endif
 
+if have_wayland and cpp.has_header('qpa/qplatformnativeinterface.h', dependencies: qt6_dep)
+    qt_plugin_sources += files(
+        'maininterface/compositor_wayland.cpp',
+    )
+endif
+
 qrc_files = files('assets.qrc')
 if host_system == 'windows'
   qrc_files += files('windows.qrc')
@@ -1094,6 +1104,70 @@ if qt6_dep.found()
         qt_extra_flags += '-DQT_GUI_PRIVATE'
     endif
 
+    qt_wayland_gui_private = cpp.has_header(
+        'qpa/qplatformnativeinterface.h', dependencies: qt6_dep)
+
+    if have_wayland and qt_wayland_gui_private
+        qt_extra_flags += '-DQT_HAS_WAYLAND_COMPOSITOR'
+        qt_extra_deps += wayland_deps[0]
+
+        qt_wl_xdg_shell_xml = wayland_protocols_dir / 'stable/xdg-shell/xdg-shell.xml'
+
+        qt_wl_xdg_shell_hdr = custom_target(
+            'qt-wayland-xdg-shell-client-header',
+            output: 'xdg-shell-client-protocol.h',
+            input: qt_wl_xdg_shell_xml,
+            command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+        )
+        qt_wl_xdg_shell_code = custom_target(
+            'qt-wayland-xdg-shell-code',
+            output: 'xdg-shell-protocol.c',
+            input: qt_wl_xdg_shell_xml,
+            command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+        )
+
+        qt_wayland_sources = [
+            files(
+                'maininterface/qt_wayland_plugin.c',
+                'maininterface/compositor_wayland_module.c',
+                'maininterface/compositor_wayland_module.h',
+                'util/csdmenu_wayland.c',
+                'util/csdmenu_wayland.h',
+                'util/csdmenu_module.h',
+            ),
+            qt_wl_xdg_shell_hdr,
+            qt_wl_xdg_shell_code,
+        ]
+
+        qt_wayland_cargs = ['-DQT_HAS_WAYLAND_PROTOCOLS']
+
+        if qt6_dep.version().version_compare('>= 6.5')
+            qt_wayland_cargs += '-DQT_HAS_WAYLAND_FRACTIONAL_SCALING'
+            qt_wl_viewporter_xml = wayland_protocols_dir / 'stable/viewporter/viewporter.xml'
+            qt_wl_viewporter_hdr = custom_target(
+                'qt-wayland-viewporter-client-header',
+                output: 'viewporter-client-protocol.h',
+                input: qt_wl_viewporter_xml,
+                command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+            )
+            qt_wl_viewporter_code = custom_target(
+                'qt-wayland-viewporter-code',
+                output: 'viewporter-protocol.c',
+                input: qt_wl_viewporter_xml,
+                command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+            )
+            qt_wayland_sources += [qt_wl_viewporter_hdr, qt_wl_viewporter_code]
+        endif
+
+        vlc_modules += {
+            'name': 'qt_wayland',
+            'sources': qt_wayland_sources,
+            'c_args': qt_wayland_cargs,
+            'include_directories': [qt_include_dir],
+            'dependencies': [wayland_deps[0], m_lib],
+        }
+    endif
+
     if host_system == 'windows'
         qt_cppargs += libcom_cppflags
     endif


=====================================
modules/video_output/meson.build
=====================================
@@ -40,6 +40,10 @@ endif
 subdir('libplacebo')
 subdir('opengl')
 
+if have_wayland
+    subdir('wayland')
+endif
+
 if host_system == 'windows'
     subdir('win32')
 endif


=====================================
modules/video_output/wayland/meson.build
=====================================
@@ -0,0 +1,146 @@
+if not have_wayland
+    subdir_done()
+endif
+
+wayland_client_dep = wayland_deps[0]
+wayland_cursor_dep = wayland_deps[1]
+wayland_egl_dep = wayland_deps[2]
+
+wayland_inc = include_directories('.')
+
+# Protocol code generation
+viewporter_xml = wayland_protocols_dir / 'stable/viewporter/viewporter.xml'
+
+viewporter_client_hdr = custom_target(
+    'wayland-viewporter-client-header',
+    output: 'viewporter-client-protocol.h',
+    input: viewporter_xml,
+    command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+)
+
+viewporter_code = custom_target(
+    'wayland-viewporter-code',
+    output: 'viewporter-protocol.c',
+    input: viewporter_xml,
+    command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+)
+
+xdg_shell_xml = wayland_protocols_dir / 'stable/xdg-shell/xdg-shell.xml'
+
+xdg_shell_client_hdr = custom_target(
+    'wayland-xdg-shell-client-header',
+    output: 'xdg-shell-client-protocol.h',
+    input: xdg_shell_xml,
+    command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+)
+
+xdg_shell_code = custom_target(
+    'wayland-xdg-shell-code',
+    output: 'xdg-shell-protocol.c',
+    input: xdg_shell_xml,
+    command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+)
+
+xdg_decoration_xml = wayland_protocols_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'
+
+xdg_decoration_client_hdr = custom_target(
+    'wayland-xdg-decoration-client-header',
+    output: 'xdg-decoration-client-protocol.h',
+    input: xdg_decoration_xml,
+    command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+)
+xdg_decoration_code = custom_target(
+    'wayland-xdg-decoration-code',
+    output: 'xdg-decoration-protocol.c',
+    input: xdg_decoration_xml,
+    command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+)
+xdg_decoration_sources = [xdg_decoration_client_hdr, xdg_decoration_code]
+
+vlc_modules += {
+    'name': 'wl_shm',
+    'sources': [
+        files('registry.c', 'registry.h', 'shm.c'),
+        viewporter_client_hdr,
+        viewporter_code,
+    ],
+    'include_directories': [wayland_inc],
+    'dependencies': [wayland_client_dep],
+}
+
+xkbcommon_dep = dependency('xkbcommon', required: false)
+
+shell_common_sources = files(
+    'output.c', 'output.h',
+    'input.c', 'input.h',
+    '../xcb/xkb.c',
+    'xdg-shell.c',
+)
+
+shell_common_deps = [wayland_client_dep, wayland_cursor_dep]
+shell_common_cargs = []
+
+if xkbcommon_dep.found()
+    shell_common_cargs += '-DHAVE_XKBCOMMON'
+    shell_common_deps += xkbcommon_dep
+endif
+
+vlc_modules += {
+    'name': 'xdg_shell',
+    'sources': [
+        shell_common_sources,
+        xdg_shell_client_hdr,
+        xdg_shell_code,
+        xdg_decoration_sources,
+    ],
+    'c_args': shell_common_cargs + ['-DXDG_SHELL'],
+    'include_directories': [wayland_inc],
+    'dependencies': shell_common_deps,
+}
+
+vlc_modules += {
+    'name': 'wl_shell',
+    'sources': [
+        shell_common_sources,
+    ],
+    'c_args': shell_common_cargs,
+    'include_directories': [wayland_inc],
+    'dependencies': shell_common_deps,
+}
+
+if egl_dep.found()
+    vlc_modules += {
+        'name': 'egl_wl',
+        'sources': files('../opengl/egl.c'),
+        'c_args': ['-DUSE_PLATFORM_WAYLAND=1'],
+        'dependencies': [egl_dep, wayland_egl_dep],
+    }
+
+    if gbm_dep.found() and drm_dep.found()
+        linux_dmabuf_xml = wayland_protocols_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'
+
+        linux_dmabuf_client_hdr = custom_target(
+            'wayland-linux-dmabuf-client-header',
+            output: 'linux-dmabuf-client-protocol.h',
+            input: linux_dmabuf_xml,
+            command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+        )
+        linux_dmabuf_code = custom_target(
+            'wayland-linux-dmabuf-code',
+            output: 'linux-dmabuf-protocol.c',
+            input: linux_dmabuf_xml,
+            command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+        )
+
+        vlc_modules += {
+            'name': 'egl_gbm_wl',
+            'sources': [
+                files('../opengl/egl_gbm.c'),
+                linux_dmabuf_client_hdr,
+                linux_dmabuf_code,
+            ],
+            'include_directories': [wayland_inc],
+            'dependencies': [egl_dep, wayland_egl_dep, gbm_dep, drm_dep],
+        }
+    endif
+endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6f539a6178c10a1022d73062f6ce960ce4fed3e9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6f539a6178c10a1022d73062f6ce960ce4fed3e9
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list