Merge branch 'bilelmoussaoui/fix-gir-build' into 'main'

build: Fix generating GIR

See merge request GNOME/libmks!39
This commit is contained in:
Christian Hergert 2023-08-31 16:24:16 +00:00
commit 21136f13f3
2 changed files with 16 additions and 4 deletions

View File

@ -53,6 +53,8 @@ libmks_private_sources = [
] ]
libmks_enums = gnome.mkenums_simple('mks-enums', libmks_enums = gnome.mkenums_simple('mks-enums',
body_prefix: '#include "config.h"',
decorator: '_MKS_EXTERN',
sources: libmks_enum_headers, sources: libmks_enum_headers,
install_header: true, install_header: true,
install_dir: libmks_headers_dir, install_dir: libmks_headers_dir,
@ -95,6 +97,7 @@ libmks_gresources = gnome.compile_resources(
'mks-resources', 'mks-resources',
'mks.gresource.xml', 'mks.gresource.xml',
c_name: 'mks', c_name: 'mks',
extra_args: [ '--manual-register', ],
) )
libmks_generated_sources = [ libmks_generated_sources = [
@ -151,9 +154,18 @@ pkg.generate(
) )
if get_option('introspection').allowed() if get_option('introspection').allowed()
libmks_gir_extra_args = [
'--c-include=libmks.h',
'--quiet',
'-DMKS_COMPILATION',
]
libmks_gir = gnome.generate_gir(libmks, libmks_gir = gnome.generate_gir(libmks,
sources: libmks_sources + libmks_headers, sources: libmks_sources +
libmks_headers +
libmks_generated_sources +
libmks_generated_headers,
nsversion: api_version, nsversion: api_version,
link_with: libmks,
namespace: 'Mks', namespace: 'Mks',
symbol_prefix: 'mks', symbol_prefix: 'mks',
identifier_prefix: 'Mks', identifier_prefix: 'Mks',
@ -161,7 +173,8 @@ if get_option('introspection').allowed()
include_directories: libmks_include_directories, include_directories: libmks_include_directories,
includes: ['Gio-2.0', 'Gtk-4.0'], includes: ['Gio-2.0', 'Gtk-4.0'],
install: true, install: true,
header: 'libmks-1.h' header: 'libmks-1.h',
extra_args: libmks_gir_extra_args,
) )
if get_option('vapi') if get_option('vapi')

View File

@ -41,8 +41,6 @@
static void static void
mks_init_gtypes (void) mks_init_gtypes (void)
{ {
g_resources_register (mks_get_resource ());
/* First register GTypes for QEMU IPC */ /* First register GTypes for QEMU IPC */
g_type_ensure (MKS_QEMU_TYPE_AUDIO); g_type_ensure (MKS_QEMU_TYPE_AUDIO);
g_type_ensure (MKS_QEMU_TYPE_AUDIO_IN_LISTENER); g_type_ensure (MKS_QEMU_TYPE_AUDIO_IN_LISTENER);
@ -83,6 +81,7 @@ mks_init (void)
if (g_once_init_enter (&initialized)) if (g_once_init_enter (&initialized))
{ {
mks_register_resource ();
mks_init_gtypes (); mks_init_gtypes ();
g_once_init_leave (&initialized, TRUE); g_once_init_leave (&initialized, TRUE);
} }