mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
meson: Provide our Python tools for builds
Several of our tools are installed and are used by other projects to generate code. However, there is no 'install' when projects use glib as a subproject, so we needed some way for glib to 'provide' these tools. Starting from Meson 0.46, this can be done with the meson.override_find_program() function. This also means that we can use these tools ourselves via the GNOME module and don't need to manually create command-lines.
This commit is contained in:
parent
3ba2f8333b
commit
02763e0d19
@ -20,6 +20,9 @@ gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
|
||||
install_dir : get_option('bindir'),
|
||||
configuration : gdbus_codegen_conf
|
||||
)
|
||||
# Provide gdbus-codegen for us (GNOME module)
|
||||
# and for others when we're a subproject
|
||||
meson.override_find_program('gdbus-codegen', gdbus_codegen)
|
||||
|
||||
codegen_dir = join_paths(get_option('datadir'), 'glib-2.0/codegen')
|
||||
|
||||
|
@ -229,38 +229,24 @@ gdbus_sources = files(
|
||||
subdir('gdbus-2.0/codegen')
|
||||
|
||||
# Generate xdp-dbus.{c,h}
|
||||
xdp_dbus_generated = custom_target('xdp-dbus',
|
||||
input : ['org.freedesktop.portal.Documents.xml',
|
||||
'org.freedesktop.portal.OpenURI.xml',
|
||||
'org.freedesktop.portal.NetworkMonitor.xml',
|
||||
'org.freedesktop.portal.ProxyResolver.xml'],
|
||||
output : ['xdp-dbus.h', 'xdp-dbus.c'],
|
||||
depend_files : gdbus_codegen_built_files,
|
||||
command : [python, gdbus_codegen,
|
||||
'--interface-prefix', 'org.freedesktop.portal.',
|
||||
'--output-directory', '@OUTDIR@',
|
||||
'--generate-c-code', 'xdp-dbus',
|
||||
'--c-namespace', 'GXdp',
|
||||
'--annotate', 'org.freedesktop.portal.Documents.Add()',
|
||||
'org.gtk.GDBus.C.UnixFD', 'true',
|
||||
'--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
|
||||
'org.gtk.GDBus.C.UnixFD', 'true',
|
||||
'--annotate', 'org.freedesktop.portal.Documents.AddFull()',
|
||||
'org.gtk.GDBus.C.UnixFD', 'true',
|
||||
'--annotate', 'org.freedesktop.portal.OpenURI.OpenFile()',
|
||||
'org.gtk.GDBus.C.UnixFD', 'true',
|
||||
'@INPUT@'])
|
||||
xdp_dbus_generated = gnome.gdbus_codegen('xdp-dbus',
|
||||
sources : ['org.freedesktop.portal.Documents.xml',
|
||||
'org.freedesktop.portal.OpenURI.xml',
|
||||
'org.freedesktop.portal.NetworkMonitor.xml',
|
||||
'org.freedesktop.portal.ProxyResolver.xml'],
|
||||
interface_prefix : 'org.freedesktop.portal.',
|
||||
namespace: 'GXdp',
|
||||
annotations : [
|
||||
['org.freedesktop.portal.Documents.Add()', 'org.gtk.GDBus.C.UnixFD', 'true'],
|
||||
['org.freedesktop.portal.Documents.AddNamed()', 'org.gtk.GDBus.C.UnixFD', 'true'],
|
||||
['org.freedesktop.portal.Documents.AddFull()', 'org.gtk.GDBus.C.UnixFD', 'true'],
|
||||
['org.freedesktop.portal.OpenURI.OpenFile()', 'org.gtk.GDBus.C.UnixFD', 'true']])
|
||||
|
||||
# Generate gdbus-generated.{c,h}
|
||||
gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
|
||||
input : ['dbus-daemon.xml'],
|
||||
output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
|
||||
depend_files : gdbus_codegen_built_files,
|
||||
command : [python, gdbus_codegen,
|
||||
'--interface-prefix', 'org.',
|
||||
'--output-directory', '@OUTDIR@',
|
||||
'--generate-c-code', 'gdbus-daemon-generated',
|
||||
'--c-namespace', '_G', '@INPUT@'])
|
||||
gdbus_daemon_generated = gnome.gdbus_codegen('gdbus-daemon-generated',
|
||||
'dbus-daemon.xml',
|
||||
interface_prefix: 'org.',
|
||||
namespace: '_G')
|
||||
|
||||
settings_headers = files(
|
||||
'gsettingsbackend.h',
|
||||
@ -714,27 +700,15 @@ gio_headers += settings_headers
|
||||
gio_headers += gdbus_headers
|
||||
install_headers(gio_headers, subdir : 'glib-2.0/gio/')
|
||||
|
||||
# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
|
||||
# in PATH, which means you can't bootstrap glib with its own glib-mkenums.
|
||||
gioenumtypes_h = custom_target('gioenumtypes_h',
|
||||
output : 'gioenumtypes.h',
|
||||
capture : true,
|
||||
input : gio_headers,
|
||||
install : true,
|
||||
install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
|
||||
command : [python, glib_mkenums,
|
||||
'--template', files('gioenumtypes.h.template'),
|
||||
'@INPUT@', gnetworking_h])
|
||||
|
||||
gioenumtypes_c = custom_target('gioenumtypes_c',
|
||||
output : 'gioenumtypes.c',
|
||||
capture : true,
|
||||
input : gio_headers,
|
||||
depends : [gioenumtypes_h],
|
||||
command : [python, glib_mkenums,
|
||||
'--template', files('gioenumtypes.c.template'),
|
||||
'@INPUT@', gnetworking_h])
|
||||
gioenumtypes = gnome.mkenums('gioenumtypes',
|
||||
sources : gio_headers,
|
||||
h_template : 'gioenumtypes.h.template',
|
||||
c_template : 'gioenumtypes.c.template',
|
||||
install_header : true,
|
||||
install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'))
|
||||
|
||||
gioenumtypes_c = gioenumtypes[0]
|
||||
gioenumtypes_h = gioenumtypes[1]
|
||||
gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
|
||||
|
||||
# inotify
|
||||
|
@ -100,9 +100,10 @@ foreach tool: python_tools
|
||||
install : true,
|
||||
install_dir : glib_bindir,
|
||||
)
|
||||
|
||||
# Set variables for later use
|
||||
# Set variables for later use; by gio/tests/meson.build for example
|
||||
set_variable(tool.underscorify(), tool_bin)
|
||||
# Provide tools for us (GNOME module), and for others when we're a subproject
|
||||
meson.override_find_program(tool, tool_bin)
|
||||
endforeach
|
||||
|
||||
executable('gobject-query', 'gobject-query.c',
|
||||
|
@ -44,34 +44,16 @@ foreach test_name : gobject_tests
|
||||
test(test_name, exe, env : test_env)
|
||||
endforeach
|
||||
|
||||
marshalers_h = custom_target('marshalers_h',
|
||||
output : 'marshalers.h',
|
||||
input : 'marshalers.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test',
|
||||
'--valist-marshallers',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--header',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
marshalers_c = custom_target('marshalers_c',
|
||||
output : 'marshalers.c',
|
||||
input : 'marshalers.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test',
|
||||
'--valist-marshallers',
|
||||
'--include-header=marshalers.h',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--body',
|
||||
'@INPUT@',
|
||||
],
|
||||
marshalers = gnome.genmarshal('marshalers',
|
||||
sources : 'marshalers.list',
|
||||
prefix : 'test',
|
||||
valist_marshallers : true,
|
||||
extra_args : ['--quiet']
|
||||
)
|
||||
|
||||
marshalers_c = marshalers[0]
|
||||
marshalers_h = marshalers[1]
|
||||
|
||||
exe = executable('signals',
|
||||
'signals.c', marshalers_h, marshalers_c,
|
||||
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"'],
|
||||
|
@ -1,6 +1,6 @@
|
||||
project('glib', 'c', 'cpp',
|
||||
version : '2.57.0',
|
||||
meson_version : '>= 0.45.0',
|
||||
meson_version : '>= 0.46.0',
|
||||
default_options : [
|
||||
'warning_level=1',
|
||||
'c_std=gnu89'
|
||||
@ -1776,9 +1776,10 @@ if want_systemtap and enable_dtrace
|
||||
enable_systemtap = true
|
||||
endif
|
||||
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
windows = import('windows')
|
||||
gnome = import('gnome')
|
||||
|
||||
subdir('glib')
|
||||
subdir('gobject')
|
||||
subdir('gthread')
|
||||
@ -1838,7 +1839,6 @@ if get_option('man')
|
||||
man1_dir = get_option('mandir') + '/man1'
|
||||
endif
|
||||
|
||||
gnome = import('gnome')
|
||||
subdir('docs/reference/glib')
|
||||
subdir('docs/reference/gobject')
|
||||
subdir('docs/reference/gio')
|
||||
|
Loading…
x
Reference in New Issue
Block a user