From: Mike Gorse Date: Tue, 8 Aug 2017 00:01:18 +0000 (-0500) Subject: meson: add support for gobject-introspection X-Git-Tag: AT_SPI2_CORE_2_25_90~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fat-spi2-core.git;a=commitdiff_plain;h=43d9f8a79bfcc8314bee0f560713188213b85f62 meson: add support for gobject-introspection Not 100% sure that this is done. The shared-library line seems wrong. --- diff --git a/atspi/meson.build b/atspi/meson.build index 8b48093..aa1a0a9 100644 --- a/atspi/meson.build +++ b/atspi/meson.build @@ -76,3 +76,37 @@ atspi_dep = declare_dependency(link_with: atspi, sources: atspi_enum_h, include_directories: root_inc, dependencies: [ libdbus_dep, gobject_dep, ]) + +if have_gir + gir_sources = atspi_sources + atspi_enums + atspi_headers + + gir_incs = [ + 'DBus-1.0', + 'GLib-2.0', + 'GObject-2.0' + ] + + gir_extra_args = [ + '--c-include=atspi/atspi.h', + '--pkg-export=atspi-2' + ] + + gir_dir = join_paths(atspi_datadir, 'gir-1.0') + typelib_dir = join_paths(get_option('libdir'), 'girepository-1.0') + + libatspi_gir = gnome.generate_gir( + atspi, + sources: gir_sources, + nsversion: '2.0', + namespace: atspi_gir_ns, + symbol_prefix: atspi_gir_ns.to_lower(), + identifier_prefix: atspi_gir_ns, + includes: gir_incs, + include_directories: root_inc, + install: true, + install_dir_gir: gir_dir, + install_dir_typelib: typelib_dir, + extra_args: gir_extra_args + ) +endif + diff --git a/meson.build b/meson.build index 81abd73..1a94a7f 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,8 @@ project('at-spi2-core', 'c', add_project_arguments([ '-D_POSIX_C_SOURCE', '-D_DEFAULT_SOURCE' ], language: 'c') +atspi_gir_ns = 'Atspi' + cc = meson.get_compiler('c') host_system = host_machine.system() @@ -86,6 +88,18 @@ endforeach at_spi_conf.set('ALIGNOF_DBIND_POINTER', cc.alignment('dbind_pointer', prefix: 'typedef void *dbind_pointer;')) at_spi_conf.set('ALIGNOF_DBIND_STRUCT', cc.alignment('dbind_struct', prefix: 'typedef struct { char s1; } dbind_struct;')) +# introspection support +have_gir = false + +introspection_option = get_option('enable-introspection') +if introspection_option != 'no' + gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false) + + if gir_dep.found() + have_gir = true + endif +endif + configure_file(output: 'config.h', configuration: at_spi_conf) # Compat variables for pkgconfig diff --git a/meson_options.txt b/meson_options.txt index e26c303..305fc8c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,3 +14,5 @@ option('enable_docs', description: 'Generate API reference for atspi (requires GTK-Doc)', type: 'boolean', value: false) + +option('enable-introspection', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'Enable GObject Introspection (depends on GObject)')