[gtk+/wip/baedert/meson: 820/841] build: Generate wayland protocol files
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/meson: 820/841] build: Generate wayland protocol files
- Date: Thu, 3 Nov 2016 11:16:57 +0000 (UTC)
commit 6718a4b97e650cb70dfb361dfa6da7905bd1355e
Author: Timm Bäder <mail baedert org>
Date: Sat Sep 10 20:40:02 2016 +0200
build: Generate wayland protocol files
gdk/meson.build | 141 +++++++++++++++++++--------------------
gdk/wayland/genprotocolfiles.py | 49 ++++++++++++++
gdk/wayland/meson.build | 110 ++++++++++++++++++++++++++++++
meson.build | 2 +-
meson_options.txt | 2 +-
5 files changed, 229 insertions(+), 75 deletions(-)
---
diff --git a/gdk/meson.build b/gdk/meson.build
index 488b50f..b1994ed 100644
--- a/gdk/meson.build
+++ b/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,9 +375,8 @@ 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
)
-
diff --git a/gdk/wayland/genprotocolfiles.py b/gdk/wayland/genprotocolfiles.py
new file mode 100755
index 0000000..fbf9cb8
--- /dev/null
+++ b/gdk/wayland/genprotocolfiles.py
@@ -0,0 +1,49 @@
+#!/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")
+
+
diff --git a/gdk/wayland/meson.build b/gdk/wayland/meson.build
new file mode 100644
index 0000000..85cac8b
--- /dev/null
+++ b/gdk/wayland/meson.build
@@ -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
diff --git a/meson.build b/meson.build
index aa08960..9c73616 100644
--- a/meson.build
+++ b/meson.build
@@ -184,7 +184,7 @@ configure_file(
)
subdir('gdk')
-subdir('gtk')
+# subdir('gtk')
# subdir('demos')
# subdir('tests')
# subdir('testsuite')
diff --git a/meson_options.txt b/meson_options.txt
index 28568a1..e8f8ee6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]