diff options
Diffstat (limited to 'meson/test cases/vala/11 generated vapi')
9 files changed, 179 insertions, 0 deletions
diff --git a/meson/test cases/vala/11 generated vapi/libbar/bar.c b/meson/test cases/vala/11 generated vapi/libbar/bar.c new file mode 100644 index 000000000..303714194 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libbar/bar.c @@ -0,0 +1,29 @@ +#include "bar.h" +#include "foo.h" + +struct _BarBar +{ + GObject parent_instance; +}; + +G_DEFINE_TYPE (BarBar, bar_bar, G_TYPE_OBJECT) + +static void +bar_bar_class_init (BarBarClass *klass) +{ +} + +static void +bar_bar_init (BarBar *self) +{ +} + +/** + * bar_bar_return_success: + * + * Returns 0 + */ +int bar_bar_return_success(void) +{ + return foo_foo_return_success(); +} diff --git a/meson/test cases/vala/11 generated vapi/libbar/bar.h b/meson/test cases/vala/11 generated vapi/libbar/bar.h new file mode 100644 index 000000000..4ca72704b --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libbar/bar.h @@ -0,0 +1,9 @@ +#include <glib-object.h> + +#pragma once + +#define BAR_TYPE_BAR (bar_bar_get_type()) + +G_DECLARE_FINAL_TYPE (BarBar, bar_bar, BAR, BAR, GObject) + +int bar_bar_return_success(void); diff --git a/meson/test cases/vala/11 generated vapi/libbar/meson.build b/meson/test cases/vala/11 generated vapi/libbar/meson.build new file mode 100644 index 000000000..648250408 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libbar/meson.build @@ -0,0 +1,33 @@ +libbar_sources = [ + 'bar.c', + 'bar.h', +] + +libbar_deps = [ + dependency('gobject-2.0'), + libfoo_dep, +] + +libbar = shared_library('bar', libbar_sources, + dependencies: libbar_deps, + install: true, +) + +libbar_api_ver = '1.0' + +libbar_gir = gnome.generate_gir(libbar, + sources: libbar_sources, + namespace: 'Bar', + nsversion: libbar_api_ver, + packages: 'gobject-2.0', + symbol_prefix: 'bar', + extra_args: [ + '--c-include=bar.h', + ], +) + +libbar_vapi = gnome.generate_vapi('bar-' + libbar_api_ver, + sources: libbar_gir[0], + packages: libfoo_vapi, + install: true, +) diff --git a/meson/test cases/vala/11 generated vapi/libfoo/foo.c b/meson/test cases/vala/11 generated vapi/libfoo/foo.c new file mode 100644 index 000000000..dd2b891fa --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libfoo/foo.c @@ -0,0 +1,28 @@ +#include "foo.h" + +struct _FooFoo +{ + GObject parent_instance; +}; + +G_DEFINE_TYPE (FooFoo, foo_foo, G_TYPE_OBJECT) + +static void +foo_foo_class_init (FooFooClass *klass) +{ +} + +static void +foo_foo_init (FooFoo *self) +{ +} + +/** + * foo_foo_return_success: + * + * Returns 0 + */ +int foo_foo_return_success(void) +{ + return 0; +} diff --git a/meson/test cases/vala/11 generated vapi/libfoo/foo.h b/meson/test cases/vala/11 generated vapi/libfoo/foo.h new file mode 100644 index 000000000..e1887d8c3 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libfoo/foo.h @@ -0,0 +1,9 @@ +#include <glib-object.h> + +#pragma once + +#define FOO_TYPE_FOO (foo_foo_get_type()) + +G_DECLARE_FINAL_TYPE (FooFoo, foo_foo, Foo, FOO, GObject) + +int foo_foo_return_success(void); diff --git a/meson/test cases/vala/11 generated vapi/libfoo/meson.build b/meson/test cases/vala/11 generated vapi/libfoo/meson.build new file mode 100644 index 000000000..482c8fe72 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/libfoo/meson.build @@ -0,0 +1,36 @@ +libfoo_sources = [ + 'foo.c', + 'foo.h', +] + +libfoo_deps = [ + dependency('gobject-2.0') +] + +libfoo = shared_library('foo', libfoo_sources, + dependencies: libfoo_deps, + install: true, +) + +libfoo_api_ver = '1.0' + +libfoo_gir = gnome.generate_gir(libfoo, + sources: libfoo_sources, + namespace: 'Foo', + nsversion: libfoo_api_ver, + packages: 'gobject-2.0', + symbol_prefix: 'foo', + extra_args: [ + '--c-include=foo.h', + ], +) + +libfoo_vapi = gnome.generate_vapi('foo-' + libfoo_api_ver, + sources: libfoo_gir[0], + install: true, +) + +libfoo_dep = declare_dependency( + link_with: libfoo, + include_directories: include_directories('.'), +) diff --git a/meson/test cases/vala/11 generated vapi/main.vala b/meson/test cases/vala/11 generated vapi/main.vala new file mode 100644 index 000000000..d61fba0f4 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/main.vala @@ -0,0 +1,9 @@ +using Foo; +using Bar; + +class Main : GLib.Object { + public static int main(string[] args) { + var ignore = Foo.Foo.return_success(); + return Bar.Bar.return_success(); + } +} diff --git a/meson/test cases/vala/11 generated vapi/meson.build b/meson/test cases/vala/11 generated vapi/meson.build new file mode 100644 index 000000000..d5f38cad6 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/meson.build @@ -0,0 +1,13 @@ +project('vapi-test', ['c', 'vala']) + +gnome = import('gnome') +subdir('libfoo') +subdir('libbar') + +vapiexe = executable('vapigen-test', + 'main.vala', + dependencies: [dependency('gobject-2.0'), libfoo_vapi, libbar_vapi], + install: true, +) + +test('vapigen-test', vapiexe) diff --git a/meson/test cases/vala/11 generated vapi/test.json b/meson/test cases/vala/11 generated vapi/test.json new file mode 100644 index 000000000..1a742aa89 --- /dev/null +++ b/meson/test cases/vala/11 generated vapi/test.json @@ -0,0 +1,13 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/vapigen-test"}, + {"type": "expr", "file": "usr/lib/?libfoo.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libfoo.dll.a"}, + {"type": "expr", "file": "usr/lib/?libbar.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libbar.dll.a"}, + {"type": "file", "file": "usr/share/vala/vapi/foo-1.0.vapi"}, + {"type": "file", "file": "usr/share/vala/vapi/foo-1.0.deps"}, + {"type": "file", "file": "usr/share/vala/vapi/bar-1.0.vapi"}, + {"type": "file", "file": "usr/share/vala/vapi/bar-1.0.deps"} + ] +} |