build: Generate wayland protocol files
This commit is contained in:
committed by
Emmanuele Bassi
parent
3933421cd3
commit
959f57d6bb
140
gdk/meson.build
140
gdk/meson.build
@@ -133,80 +133,75 @@ gdk_x_private_sources = [
|
||||
'x11/gdkdevicemanagerprivate-core.h',
|
||||
]
|
||||
|
||||
# gdk_wayland_sources = [
|
||||
# 'wayland/gdkapplaunchcontext-wayland.c',
|
||||
# 'wayland/gdkcursor-wayland.c',
|
||||
# 'wayland/gdkdevice-wayland.c',
|
||||
# 'wayland/gdkdisplay-wayland.c',
|
||||
# 'wayland/gdkdisplay-wayland.h',
|
||||
# 'wayland/gdkdnd-wayland.c',
|
||||
# 'wayland/gdkeventsource.c',
|
||||
# 'wayland/gdkglcontext-wayland.c',
|
||||
# 'wayland/gdkglcontext-wayland.h',
|
||||
# 'wayland/gdkkeys-wayland.c',
|
||||
# 'wayland/gdkmonitor-wayland.c',
|
||||
# 'wayland/gdkmonitor-wayland.h',
|
||||
# 'wayland/gdkscreen-wayland.c',
|
||||
# 'wayland/gdkseat-wayland.h',
|
||||
# 'wayland/gdkselection-wayland.c',
|
||||
# 'wayland/gdkwaylanddevice.h',
|
||||
# 'wayland/gdkwaylanddisplay.h',
|
||||
# 'wayland/gdkwaylandglcontext.h',
|
||||
# 'wayland/gdkwayland.h',
|
||||
# 'wayland/gdkwaylandmonitor.h',
|
||||
# 'wayland/gdkwaylandselection.h',
|
||||
# 'wayland/gdkwaylandwindow.h',
|
||||
# 'wayland/gdkwindow-wayland.c',
|
||||
# 'wayland/wm-button-layout-translation.c',
|
||||
# 'wayland/gtk-primary-selection-protocol.c',
|
||||
# 'wayland/gtk-shell-protocol.c',
|
||||
# 'wayland/xdg-shell-unstable-v5-protocol.c',
|
||||
# 'wayland/pointer-gestures-unstable-v1-protocol.c',
|
||||
# 'wayland/tablet-unstable-v2-protocol.c',
|
||||
# ]
|
||||
gdk_wayland_sources = files([
|
||||
'wayland/gdkapplaunchcontext-wayland.c',
|
||||
'wayland/gdkcursor-wayland.c',
|
||||
'wayland/gdkdevice-wayland.c',
|
||||
'wayland/gdkdisplay-wayland.c',
|
||||
'wayland/gdkdisplay-wayland.h',
|
||||
'wayland/gdkdnd-wayland.c',
|
||||
'wayland/gdkeventsource.c',
|
||||
'wayland/gdkglcontext-wayland.c',
|
||||
'wayland/gdkglcontext-wayland.h',
|
||||
'wayland/gdkkeys-wayland.c',
|
||||
'wayland/gdkmonitor-wayland.c',
|
||||
'wayland/gdkmonitor-wayland.h',
|
||||
'wayland/gdkscreen-wayland.c',
|
||||
'wayland/gdkseat-wayland.h',
|
||||
'wayland/gdkselection-wayland.c',
|
||||
'wayland/gdkwaylanddevice.h',
|
||||
'wayland/gdkwaylanddisplay.h',
|
||||
'wayland/gdkwaylandglcontext.h',
|
||||
'wayland/gdkwayland.h',
|
||||
'wayland/gdkwaylandmonitor.h',
|
||||
'wayland/gdkwaylandselection.h',
|
||||
'wayland/gdkwaylandwindow.h',
|
||||
'wayland/gdkwindow-wayland.c',
|
||||
'wayland/wm-button-layout-translation.c',
|
||||
])
|
||||
|
||||
# gdk_wayland_private_sources = [
|
||||
# 'wayland/gdkprivate-wayland.h',
|
||||
# ]
|
||||
gdk_wayland_private_sources = files([
|
||||
'wayland/gdkprivate-wayland.h',
|
||||
])
|
||||
|
||||
|
||||
|
||||
# gdk_broadway_sources = [
|
||||
# 'broadway/gdkdisplay-broadway.c',
|
||||
# 'broadway/gdkdisplay-broadway.h',
|
||||
# 'broadway/gdkscreen-broadway.c',
|
||||
# 'broadway/gdkscreen-broadway.h',
|
||||
# 'broadway/broadway-output.c',
|
||||
# 'broadway/broadway-output.h',
|
||||
# 'broadway/broadway-server.h',
|
||||
# 'broadway/broadway-server.c',
|
||||
# 'broadway/gdkbroadway-server.c',
|
||||
# 'broadway/gdkcursor-broadway.c',
|
||||
# 'broadway/gdkvisual-broadway.c',
|
||||
# 'broadway/gdkselection-broadway.c',
|
||||
# 'broadway/gdkwindow-broadway.c',
|
||||
# 'broadway/gdkwindow-broadway.h',
|
||||
# 'broadway/gdkmonitor-broadway.c',
|
||||
# 'broadway/gdkmonitor-broadway.h',
|
||||
# 'broadway/gdkkeys-broadway.c',
|
||||
# 'broadway/gdkglobals-broadway.c',
|
||||
# 'broadway/gdkeventsource.c',
|
||||
# 'broadway/gdkeventsource.h',
|
||||
# 'broadway/gdkdnd-broadway.c',
|
||||
# 'broadway/broadwayd.c',
|
||||
# 'broadway/gdkdevicemanager-broadway.c',
|
||||
# 'broadway/gdkdevicemanager-broadway.h',
|
||||
# 'broadway/gdkdevice-broadway.c',
|
||||
# 'broadway/gdkdevice-broadway.h',
|
||||
# 'broadway/broadway-buffer.c',
|
||||
# 'broadway/broadway-buffer.h',
|
||||
# 'broadway/gdktestutils-broadway.c',
|
||||
# 'broadway/gdkproperty-broadway.c'
|
||||
# ]
|
||||
gdk_broadway_sources = files([
|
||||
'broadway/gdkdisplay-broadway.c',
|
||||
'broadway/gdkdisplay-broadway.h',
|
||||
'broadway/gdkscreen-broadway.c',
|
||||
'broadway/gdkscreen-broadway.h',
|
||||
'broadway/broadway-output.c',
|
||||
'broadway/broadway-output.h',
|
||||
'broadway/broadway-server.h',
|
||||
'broadway/broadway-server.c',
|
||||
'broadway/gdkbroadway-server.c',
|
||||
'broadway/gdkcursor-broadway.c',
|
||||
'broadway/gdkvisual-broadway.c',
|
||||
'broadway/gdkselection-broadway.c',
|
||||
'broadway/gdkwindow-broadway.c',
|
||||
'broadway/gdkwindow-broadway.h',
|
||||
'broadway/gdkmonitor-broadway.c',
|
||||
'broadway/gdkmonitor-broadway.h',
|
||||
'broadway/gdkkeys-broadway.c',
|
||||
'broadway/gdkglobals-broadway.c',
|
||||
'broadway/gdkeventsource.c',
|
||||
'broadway/gdkeventsource.h',
|
||||
'broadway/gdkdnd-broadway.c',
|
||||
'broadway/broadwayd.c',
|
||||
'broadway/gdkdevicemanager-broadway.c',
|
||||
'broadway/gdkdevicemanager-broadway.h',
|
||||
'broadway/gdkdevice-broadway.c',
|
||||
'broadway/gdkdevice-broadway.h',
|
||||
'broadway/broadway-buffer.c',
|
||||
'broadway/broadway-buffer.h',
|
||||
'broadway/gdktestutils-broadway.c',
|
||||
'broadway/gdkproperty-broadway.c'
|
||||
])
|
||||
|
||||
# gdk_broadway_private_sources = [
|
||||
# 'broadway/gdkprivate-broadway.h'
|
||||
# ]
|
||||
gdk_broadway_private_sources = files([
|
||||
'broadway/gdkprivate-broadway.h'
|
||||
])
|
||||
|
||||
# glsl_sources = [
|
||||
# 'gl3-texture-2d.fs.glsl',
|
||||
@@ -297,7 +292,7 @@ gdkversionmacros = configure_file(
|
||||
)
|
||||
|
||||
xinc = include_directories('x11')
|
||||
wlinc = include_directories('wayland')
|
||||
wlinc = include_directories('.')
|
||||
|
||||
|
||||
gdk_deps = [
|
||||
@@ -343,6 +338,7 @@ if x11_enabled
|
||||
endif
|
||||
|
||||
if wayland_enabled
|
||||
subdir('wayland')
|
||||
gdk_deps += [
|
||||
shmlib,
|
||||
xkbdep,
|
||||
@@ -371,7 +367,7 @@ endif
|
||||
libgdk = shared_library('gdk',
|
||||
gdk_sources,
|
||||
c_args: ['-DHAVE_CONFIG_H', '-DGDK_COMPILATION'],
|
||||
include_directories: [confinc, xinc],
|
||||
include_directories: [confinc, xinc, wlinc],
|
||||
dependencies: gdk_deps,
|
||||
)
|
||||
|
||||
@@ -379,7 +375,7 @@ libgdk = shared_library('gdk',
|
||||
libgdk_dep = declare_dependency(
|
||||
sources: ['gdk.h', gdkconfig, gdkenum_h],
|
||||
depends: gdk_sources,
|
||||
include_directories: [confinc, xinc],
|
||||
include_directories: [confinc, xinc, wlinc],
|
||||
dependencies: gdk_deps,
|
||||
link_with: libgdk
|
||||
)
|
||||
|
||||
47
gdk/wayland/genprotocolfiles.py
Executable file
47
gdk/wayland/genprotocolfiles.py
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
scanner = sys.argv[1]
|
||||
in_file = sys.argv[2]
|
||||
out_file = sys.argv[3]
|
||||
#TODO: We can infer this optinon from the name of the output file!
|
||||
option = sys.argv[4]
|
||||
|
||||
|
||||
|
||||
pc = subprocess.Popen([scanner, option , in_file , out_file], stdout=subprocess.PIPE)
|
||||
(stdo, _) = pc.communicate()
|
||||
if pc.returncode != 0:
|
||||
sys.exit(pc.returncode)
|
||||
|
||||
# Now read the generated file again and remove all WL_EXPORTs
|
||||
content = ""
|
||||
with open(out_file, 'r') as content_file:
|
||||
content = content_file.read()
|
||||
|
||||
content = content.replace("WL_EXPORT", "")
|
||||
ofile = open(out_file, 'w')
|
||||
ofile.write(content)
|
||||
ofile.close()
|
||||
|
||||
|
||||
|
||||
# unstable = False
|
||||
|
||||
# if "unstable" in out_file:
|
||||
# unstable = True
|
||||
|
||||
|
||||
# if out_file.endswith("-protocol.c"):
|
||||
# print("protocol source")
|
||||
# elif out_file.endswith("-client-protocol.h"):
|
||||
# print("client protocol header")
|
||||
# elif out_file.endswith("-server-protocol.h"):
|
||||
# print("server protocol header")
|
||||
# else:
|
||||
# print("ERROR: '",out_file,"' is not a valid output file")
|
||||
110
gdk/wayland/meson.build
Normal file
110
gdk/wayland/meson.build
Normal file
@@ -0,0 +1,110 @@
|
||||
|
||||
|
||||
if wayland_enabled
|
||||
#TODO: This should come from pkg-config --variable=pkgdatadir wayland-protocols
|
||||
wayland_protocols_datadir = '/home/baedert/Source/gnome-configure/share/wayland-protocols/'
|
||||
wayland_scanner = find_program('wayland-scanner')
|
||||
genprotocols = find_program('genprotocolfiles.py')
|
||||
|
||||
gtk_shell_h = custom_target(
|
||||
'gtk shell protocol header',
|
||||
input : 'protocol/gtk-shell.xml',
|
||||
output : 'gtk-shell-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
gtk_shell_c = custom_target(
|
||||
'gtk shell protocol source',
|
||||
input : 'protocol/gtk-shell.xml',
|
||||
output : 'gtk-shell-protocol.c',
|
||||
command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
pointer_gestures_h = custom_target(
|
||||
'pointer gestures header',
|
||||
input : wayland_protocols_datadir + 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
|
||||
output : 'pointer-gestures-unstable-v1-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
pointer_gestures_c = custom_target(
|
||||
'pointer gestures source',
|
||||
input : wayland_protocols_datadir + 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
|
||||
output : 'pointer-gestures-unstable-v1-protocol.c',
|
||||
command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
primary_selection_h = custom_target(
|
||||
'primary selection header',
|
||||
input : 'protocol/gtk-primary-selection.xml',
|
||||
output : 'gtk-primary-selection-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
primary_selection_c = custom_target(
|
||||
'primary selection source',
|
||||
input : 'protocol/gtk-primary-selection.xml',
|
||||
output : 'gtk-primary-selection-protocol.c',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
xdg_shell_h = custom_target(
|
||||
'xdg shell v6 header',
|
||||
input : wayland_protocols_datadir + 'unstable/xdg-shell/xdg-shell-unstable-v6.xml',
|
||||
output : 'xdg-shell-unstable-v6-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
xdg_shell_c = custom_target(
|
||||
'xdg shell v6 source',
|
||||
input : wayland_protocols_datadir + 'unstable/xdg-shell/xdg-shell-unstable-v6.xml',
|
||||
output : 'xdg-shell-unstable-v6-protocol.c',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
xdg_foreign_h = custom_target(
|
||||
'xdg foreign v1 header',
|
||||
input : wayland_protocols_datadir + 'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml',
|
||||
output : 'xdg-foreign-unstable-v1-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
xdg_foreign_c = custom_target(
|
||||
'xdg foreign v1 source',
|
||||
input : wayland_protocols_datadir + 'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml',
|
||||
output : 'xdg-foreign-unstable-v1-protocol.c',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
tablet_h = custom_target(
|
||||
'tablet v2 header',
|
||||
input : wayland_protocols_datadir + 'unstable/tablet/tablet-unstable-v2.xml',
|
||||
output : 'tablet-unstable-v2-client-protocol.h',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'client-header']
|
||||
)
|
||||
|
||||
tablet_c = custom_target(
|
||||
'tablet v2 source',
|
||||
input : wayland_protocols_datadir + 'unstable/tablet/tablet-unstable-v2.xml',
|
||||
output : 'tablet-unstable-v2-protocol.c',
|
||||
command: [genprotocols, wayland_scanner,'@INPUT@', '@OUTPUT@', 'code']
|
||||
)
|
||||
|
||||
|
||||
|
||||
gdk_sources += [
|
||||
gtk_shell_c,
|
||||
gtk_shell_h,
|
||||
pointer_gestures_h,
|
||||
pointer_gestures_c,
|
||||
primary_selection_h,
|
||||
primary_selection_c,
|
||||
xdg_shell_h,
|
||||
xdg_shell_c,
|
||||
xdg_foreign_h,
|
||||
xdg_foreign_c,
|
||||
tablet_h,
|
||||
tablet_c
|
||||
]
|
||||
|
||||
endif
|
||||
@@ -184,7 +184,7 @@ configure_file(
|
||||
)
|
||||
|
||||
subdir('gdk')
|
||||
subdir('gtk')
|
||||
# subdir('gtk')
|
||||
# subdir('demos')
|
||||
# subdir('tests')
|
||||
# subdir('testsuite')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
option('enable-x11-backend', type: 'boolean', value: 'true')
|
||||
option('enable-wayland-backend', type: 'boolean', value: 'false')
|
||||
option('enable-wayland-backend', type: 'boolean', value: 'true')
|
||||
option('enable-broadway-backend', type: 'boolean', value: 'false')
|
||||
|
||||
Reference in New Issue
Block a user