meson: gdk: build individual backends as static libs

This is how it's done in the autotools build. Also avoids problems
with multiple source files having the same name (gdkeventsource.c).

Also move broadway backend code into broadway subdir.
This commit is contained in:
Tim-Philipp Müller 2017-03-20 00:37:09 +00:00 committed by Emmanuele Bassi
parent d4881df0d8
commit e001d95538
6 changed files with 88 additions and 59 deletions

63
gdk/broadway/meson.build Normal file
View File

@ -0,0 +1,63 @@
gdk_broadway_sources = files([
'broadway-buffer.c',
'broadway-output.c',
'broadway-server.c',
'broadwayd.c',
'gdkbroadway-server.c',
'gdkcursor-broadway.c',
'gdkdevice-broadway.c',
'gdkdevicemanager-broadway.c',
'gdkdisplay-broadway.c',
'gdkdnd-broadway.c',
'gdkeventsource.c',
'gdkglobals-broadway.c',
'gdkkeys-broadway.c',
'gdkmonitor-broadway.c',
'gdkproperty-broadway.c',
'gdkscreen-broadway.c',
'gdkselection-broadway.c',
'gdkwindow-broadway.c',
])
gdk_broadway_public_headers = [
'gdkbroadwaydisplay.h',
'gdkbroadwaywindow.h',
'gdkbroadwaycursor.h',
'gdkbroadwaymonitor.h',
]
# Broadway backend headers aren't installed it seems
#install_headers(gdk_broadway_public_headers, subdir: 'gtk-4.0/gdk/broadway/')
#install_headers('gdkbroadway.h', subdir: 'gtk-4.0/gdk/')
gdk_broadway_deps = [shmlib]
libgdk_broadway = static_library('libgdk-broadway',
gdk_broadway_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
dependencies: [gdk_deps, gdk_broadway_deps])
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
clienthtml_h = custom_target('clienthtml.h',
input : 'client.html',
output : 'clienthtml.h',
command : [find_program('toarray.pl'), 'client_html', '@INPUT@'],
capture : true)
broadwayjs_h = custom_target('broadwayjs.h',
input : ['broadway.js', 'rawinflate.min.js'],
output : 'broadwayjs.h',
command : [find_program('toarray.pl'), 'broadway_js', '@INPUT0@', '@INPUT1@'],
capture : true)
executable('gtk4-broadwayd',
clienthtml_h, broadwayjs_h,
'broadwayd.c', 'broadway-server.c', 'broadway-buffer.c', 'broadway-output.c',
include_directories: [confinc, gdkinc],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
dependencies : [broadwayd_syslib, gdk_deps],
install : true)

View File

@ -84,41 +84,6 @@ gdk_private_h_sources = files([
'gdkseatdefaultprivate.h',
])
gdk_broadway_sources = files([
'broadway/broadway-buffer.c',
'broadway/broadway-buffer.h',
'broadway/broadway-output.c',
'broadway/broadway-output.h',
'broadway/broadway-server.c',
'broadway/broadway-server.h',
'broadway/broadwayd.c',
'broadway/gdkbroadway-server.c',
'broadway/gdkcursor-broadway.c',
'broadway/gdkdevice-broadway.c',
'broadway/gdkdevice-broadway.h',
'broadway/gdkdevicemanager-broadway.c',
'broadway/gdkdevicemanager-broadway.h',
'broadway/gdkdisplay-broadway.c',
'broadway/gdkdisplay-broadway.h',
'broadway/gdkdnd-broadway.c',
'broadway/gdkeventsource.c',
'broadway/gdkeventsource.h',
'broadway/gdkglobals-broadway.c',
'broadway/gdkkeys-broadway.c',
'broadway/gdkmonitor-broadway.c',
'broadway/gdkmonitor-broadway.h',
'broadway/gdkproperty-broadway.c',
'broadway/gdkscreen-broadway.c',
'broadway/gdkscreen-broadway.h',
'broadway/gdkselection-broadway.c',
'broadway/gdkwindow-broadway.c',
'broadway/gdkwindow-broadway.h',
])
gdk_broadway_private_sources = files([
'broadway/gdkprivate-broadway.h'
])
gdk_gresource_xml = configure_file(output : 'gdk.gresource.xml',
input : 'gen-gsk-resources-xml.py',
command : [find_program('gen-gdk-gresources-xml.py'),
@ -172,6 +137,8 @@ gdkversionmacros = configure_file(
configuration: gdkversion_cdata,
install_dir: 'include/gtk-4.0/gdk/')
gdkinc = include_directories('.')
xinc = include_directories('x11')
wlinc = include_directories('.')
@ -210,32 +177,20 @@ if wayland_enabled or broadway_enabled
endif
endif
if x11_enabled
subdir('x11')
gdk_deps += gdk_x11_deps
gdk_sources += gdk_x11_sources
endif
if wayland_enabled
subdir('wayland')
gdk_deps += gdk_wayland_deps
gdk_sources += gdk_wayland_sources
endif
if broadway_enabled
gdk_deps += [
shmlib,
]
gdk_sources += [
gdk_broadway_sources,
gdk_broadway_private_sources
]
endif
gdk_backends = []
foreach backend : ['broadway', 'wayland', 'x11']
if get_variable('@0@_enabled'.format(backend))
subdir(backend)
gdk_deps += get_variable('gdk_@0@_deps'.format(backend))
gdk_backends += get_variable('libgdk_@0@'.format(backend))
endif
endforeach
libgdk = static_library('gdk',
sources: [gdk_sources, gdkconfig],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
include_directories: [confinc, xinc, wlinc],
link_with: gdk_backends,
dependencies: gdk_deps,
)

View File

@ -1 +0,0 @@
#include "gdkeventsource.c"

View File

@ -4,7 +4,7 @@ gdk_wayland_sources = files([
'gdkdevice-wayland.c',
'gdkdisplay-wayland.c',
'gdkdnd-wayland.c',
'gdkeventsource-wayland.c',
'gdkeventsource.c',
'gdkglcontext-wayland.c',
'gdkkeys-wayland.c',
'gdkmonitor-wayland.c',
@ -79,3 +79,9 @@ foreach p : proto_sources
output : '@0@-protocol.c'.format(output_base),
command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'code'])
endforeach
libgdk_wayland = static_library('libgdk-wayland',
gdk_wayland_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
dependencies: [gdk_deps, gdk_wayland_deps])

View File

@ -65,3 +65,9 @@ gdk_x11_deps = [
xcomposite_dep,
xrandr_dep,
]
libgdk_x11 = static_library('libgdk-x11',
gdk_x11_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
dependencies: [gdk_deps, gdk_x11_deps])

View File

@ -795,7 +795,7 @@ gnome.compile_schemas()
# install_headers(a11y_headers, subdir: 'gtk-3.0/gtk/a11y/')
libgtk = shared_library('gtk',
sources: [typefuncs, gtk_sources, gtkmarshal_h],
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
c_args: gtk_cargs,
include_directories: [confinc, gdkinc, gtkinc],
dependencies: [gtk_deps, libgdk_dep, libgsk_dep],