[gtk+/wip/meson: 17/136] meson: Add options for x/wayland/broadway backends



commit 0727cab1e234df9a63a291ef165e266c6ee3f625
Author: Timm Bäder <mail baedert org>
Date:   Sun Aug 21 17:16:03 2016 +0200

    meson: Add options for x/wayland/broadway backends

 config.h.meson    |    6 +++
 gdk/meson.build   |   99 ++++++++++++++++++++++++++++-------------------------
 gtk/meson.build   |   76 ++++++++++++++++++++++------------------
 meson.build       |    8 ++++
 meson_options.txt |    3 ++
 5 files changed, 111 insertions(+), 81 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index 45527bf..e6cd25d 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -309,3 +309,9 @@
 
 /* Define to 1 if linux/memfd.h exists */
 #mesondefine HAVE_LINUX_MEMFD_H
+
+#mesondefine GTK_LOCALEDIR
+
+#mesondefine GTK_DATADIR
+
+#mesondefine GTK_LIBDIR
diff --git a/gdk/meson.build b/gdk/meson.build
index c5ab62d..87ebb5f 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -249,9 +249,9 @@ gdkmarshal_c = custom_target('gdkmarshal_c',
 
 
 cdata = configuration_data()
-cdata.set('GDK_WINDOWING_X11', 1)
-cdata.set('GDK_WINDOWING_WAYLAND', 1)
-cdata.set('GDK_WINDOWING_BROADWAY', 1)
+if x11_enabled      cdata.set('GDK_WINDOWING_X11', 1)      endif
+if wayland_enabled  cdata.set('GDK_WINDOWING_WAYLAND', 1)  endif
+if broadway_enabled cdata.set('GDK_WINDOWING_BROADWAY', 1) endif
 gdkconfig = configure_file(input : 'gdkconfig.h.meson',
   output : 'gdkconfig.h',
   configuration : cdata
@@ -260,63 +260,68 @@ gdkconfig = configure_file(input : 'gdkconfig.h.meson',
 xinc = include_directories('x11')
 wlinc = include_directories('wayland')
 
-libgdk_dep = declare_dependency(
-  sources: ['gdk.h'],
-  include_directories: [confinc, xinc, wlinc],
-  dependencies: [
-    mlib,
-    shmlib,
+
+gdk_deps = [
+  mlib,
+  pixbuf_dep,
+  cairo_dep,
+  pango_dep,
+  cairogobj_dep,
+  glib_dep,
+  epoxy_dep,
+  fontconfig_dep,
+  giounix_dep,
+  pangocairo_dep
+]
+
+gdk_sources = [
+  gdkconfig,
+  gdk_sources,
+  deprecated_gdk_sources,
+  gdkenum_c, gdkenum_h,
+  gdkmarshal_c, gdkmarshal_h,
+  gdkresources
+]
+
+if x11_enabled
+  gdk_deps += [
     xrender_dep,
     xi_dep,
     xext_dep,
     x11_dep,
-    fontconfig_dep,
-    epoxy_dep,
-    giounix_dep,
-    glib_dep,
-    pangocairo_dep,
-    cairogobj_dep,
-    pango_dep,
-    cairo_dep,
-    pixbuf_dep,
+  ]
+  gdk_sources += [
+    gdk_x_sources,
+    gdk_x_private_sources
+  ]
+endif
+
+if wayland_enabled
+  gdk_deps += [
+    shmlib,
     xkbdep,
     wlclientdep,
     wlprotocolsdep,
     wlcursordep,
     wlegldep
   ]
+  gdk_sources += [
+    gdk_wayland_sources,
+    gdk_wayland_private_sources
+  ]
+endif
+
+
+
+libgdk_dep = declare_dependency(
+  sources: ['gdk.h'],
+  include_directories: [confinc, xinc, wlinc],
+  dependencies: gdk_deps,
 )
 
 libgdk = shared_library('gdk',
-  gdkconfig,
-  gdk_sources, deprecated_gdk_sources,
-  gdkenum_c, gdkenum_h,
-  gdkmarshal_h, gdkmarshal_c, gdkresources,
-  gdk_x_sources, gdk_x_private_sources,
-  gdk_wayland_sources, gdk_wayland_private_sources,
-  gdk_broadway_sources, gdk_broadway_private_sources,
+  gdk_sources,
   c_args: ['-DHAVE_CONFIG_H', '-DGDK_COMPILATION'],
   include_directories: [confinc, xinc, wlinc],
-  dependencies: [
-    mlib,
-    shmlib,
-    xrender_dep,
-    xi_dep,
-    xext_dep,
-    x11_dep,
-    fontconfig_dep,
-    epoxy_dep,
-    giounix_dep,
-    glib_dep,
-    pangocairo_dep,
-    cairogobj_dep,
-    pango_dep,
-    cairo_dep,
-    pixbuf_dep,
-    xkbdep,
-    wlclientdep,
-    wlprotocolsdep,
-    wlcursordep,
-    wlegldep
-  ]
+  dependencies: gdk_deps,
 )
diff --git a/gtk/meson.build b/gtk/meson.build
index fd83a71..2c77bdf 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -411,12 +411,18 @@ gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', 'gtkdbusinterfaces.xml',
                                    interface_prefix: 'org.Gtk.',
                                    namespace: '_Gtk')
 
-libgtk_dep = declare_dependency(
-  link_with: libgdk,
-  sources: [
-    'gtk.h'
-  ],
-  dependencies: [
+
+gtk_sources = [
+  gtk_sources,
+  gtk_dbus_src,
+  gtk_unix_sources,
+  gtk_deprecated_c_sources,
+  dnd_sources,
+  inspector_sources,
+  a11y_sources,
+]
+
+gtk_deps = [
     gmodule_dep,
     giounix_dep,
     glib_dep,
@@ -431,47 +437,49 @@ libgtk_dep = declare_dependency(
     atk_dep,
     epoxy_dep,
     mlib,
+    libgdk_dep
+]
+
+if x11_enabled
+  gtk_sources += [
+    gtk_x11_sources,
+    gtk_use_wayland_or_x11_c_sources
+  ]
+  gtk_deps += [
     xi_dep,
     x11_dep,
-    libgdk_dep
+  ]
+endif
+
+if wayland_enabled
+  gtk_sources += [
+    gtk_wayland_sources,
+    gtk_use_wayland_or_x11_c_sources
+  ]
+endif
+
+
+libgtk_dep = declare_dependency(
+  link_with: libgdk,
+  sources: [
+    'gtk.h'
   ],
+  dependencies: gtk_deps,
   include_directories: confinc
 )
 
 
 libgtk = shared_library('gtk',
-  gtk_sources, gtk_dbus_src, gtk_unix_sources,
-  gtk_deprecated_c_sources, dnd_sources,
-  inspector_sources, a11y_sources,
-  gtk_x11_sources, gtk_wayland_sources,
-  gtk_use_wayland_or_x11_c_sources,
+  gtk_sources,
   c_args: [
     '-DGTK_COMPILATION', '-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
-    '-DGTK_BINARY_VERSION="3"', '-DGTK_HOST="bob"', '-DGTK_DATADIR="dir"',
-    '-DGTK_LIBDIR="libdir"', '-DGTK_SYSCONFDIR="sysconfdir"',
-    '-DGTK_LOCALEDIR="localedir"', '-DGTK_DATA_PREFIX="dataprefix"',
+    '-DGTK_BINARY_VERSION="3"', '-DGTK_HOST="bob"',
+    '-DGTK_SYSCONFDIR="sysconfdir"',
+    '-DGTK_DATA_PREFIX="dataprefix"',
     '-DGTK_PRINT_BACKENDS="null"', '-DGTK_VERSION="3"',
     '-DX11_DATA_PREFIX="/share/x11/locale"'
   ],
   include_directories: [ confinc, gdkinc ],
-  dependencies: [
-    gmodule_dep,
-    giounix_dep,
-    glib_dep,
-    atkbridge_dep,
-    pangocairo_dep,
-    pangoft_dep,
-    pango_dep,
-    cairogobj_dep,
-    cairo_dep,
-    fontconfig_dep,
-    pixbuf_dep,
-    atk_dep,
-    epoxy_dep,
-    mlib,
-    xi_dep,
-    x11_dep,
-    libgdk_dep
-  ],
+  dependencies: gtk_deps,
   link_with: libgdk
 )
diff --git a/meson.build b/meson.build
index 9434189..ae9c670 100644
--- a/meson.build
+++ b/meson.build
@@ -19,9 +19,17 @@ gtk_micro_version = gtk_version[2]
 gtk_binary_age = 100 * gtk_minor_version.to_int() + gtk_micro_version.to_int()
 gtk_api_version = '@0@.0'.format(gtk_major_version)
 
+x11_enabled      = get_option('enable-x11-backend')
+wayland_enabled  = get_option('enable-wayland-backend')
+broadway_enabled = get_option('enable-broadway-backend')
+
+
 cc = meson.get_compiler('c')
 cdata = configuration_data()
 cdata.set('PACKAGE_VERSION', '"'+meson.project_version()+'"')
+cdata.set('GTK_LOCALEDIR', '"'+get_option('localedir')+'"')
+cdata.set('GTK_DATADIR', '"'+get_option('datadir')+'"')
+cdata.set('GTK_LIBDIR', '"'+get_option('libdir')+'"')
 check_headers = [
   ['HAVE_CRT_EXTERNS_H', 'crt/externs.h'],
   ['HAVE_DLFCN_H', 'dlfcn.h'],
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..28568a1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-x11-backend', type: 'boolean', value: 'true')
+option('enable-wayland-backend', type: 'boolean', value: 'false')
+option('enable-broadway-backend', type: 'boolean', value: 'false')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]