meson: Add options for x/wayland/broadway backends

This commit is contained in:
Timm Bäder 2016-08-21 17:16:03 +02:00 committed by Emmanuele Bassi
parent 5475768d32
commit 7fff2901aa
5 changed files with 130 additions and 100 deletions

View File

@ -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

View File

@ -248,9 +248,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
@ -259,63 +259,68 @@ gdkconfig = configure_file(input : 'gdkconfig.h.meson',
xinc = include_directories('x11')
wlinc = include_directories('wayland')
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,
]
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: [
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,
)
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,
)

View File

@ -411,67 +411,75 @@ gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', 'gtkdbusinterfaces.xml',
interface_prefix: 'org.Gtk.',
namespace: '_Gtk')
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,
atkbridge_dep,
pangocairo_dep,
pangoft_dep,
pango_dep,
cairogobj_dep,
cairo_dep,
fontconfig_dep,
pixbuf_dep,
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,
]
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: [
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,
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
)

View File

@ -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'],

3
meson_options.txt Normal file
View File

@ -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')