Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/markdown/Gnome-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ executable(

### gnome.generate_gir()

Generates GObject introspection data. Takes one positional argument,
the build target you want to build gir data for. There are several
keyword arguments. Many of these map directly to the `g-ir-scanner`
tool so see its documentation for more information.
Generates GObject introspection data.

Takes one or more positional arguments:

Either one or more library objects you want to build gir data for, or a single
executable object.

There are several keyword arguments. Many of these map directly to the
`g-ir-scanner` tool so see its documentation for more information.

* `dependencies`: deps to use during introspection scanning
* `extra_args`: command line arguments to pass to gir compiler
Expand Down
7 changes: 7 additions & 0 deletions docs/markdown/snippets/generate_gir_multiple_libraries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## gnome.generate_gir() now optionally accepts multiple libraries

The GNOME module can now generate a single gir for multiple libraries, which
is something `g-ir-scanner` supported, but had not been exposed yet.

gnome.generate_gir() will now accept multiple positional arguments, if none
of these arguments are an `Executable` instance.
405 changes: 262 additions & 143 deletions mesonbuild/modules/gnome.py

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions test cases/frameworks/7 gnome/gir/meson-sample2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "meson-sample2.h"

struct _MesonSample2
{
GObject parent_instance;
};

G_DEFINE_TYPE (MesonSample2, meson_sample2, G_TYPE_OBJECT)

/**
* meson_sample2_new:
*
* Allocates a new #MesonSample2.
*
* Returns: (transfer full): a #MesonSample2.
*/
MesonSample2 *
meson_sample2_new (void)
{
return g_object_new (MESON_TYPE_SAMPLE2, NULL);
}

static void
meson_sample2_class_init (MesonSample2Class *klass)
{
}

static void
meson_sample2_init (MesonSample2 *self)
{
}

/**
* meson_sample2_print_message:
* @self: a #MesonSample2.
*
* Prints Hello.
*
* Returns: Nothing.
*/
void
meson_sample2_print_message (MesonSample2 *self)
{
g_print ("Message: Hello\n");
}
21 changes: 21 additions & 0 deletions test cases/frameworks/7 gnome/gir/meson-sample2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef MESON_SAMPLE2_H
#define MESON_SAMPLE2_H

#if !defined (MESON_TEST)
#error "MESON_TEST not defined."
#endif

#include <glib-object.h>

G_BEGIN_DECLS

#define MESON_TYPE_SAMPLE2 (meson_sample2_get_type())

G_DECLARE_FINAL_TYPE (MesonSample2, meson_sample2, MESON, SAMPLE2, GObject)

MesonSample2 *meson_sample2_new (void);
void meson_sample2_print_message (MesonSample2 *self);

G_END_DECLS

#endif /* MESON_SAMPLE2_H */
12 changes: 10 additions & 2 deletions test cases/frameworks/7 gnome/gir/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
subdir('dep1')

libsources = ['meson-sample.c', 'meson-sample.h']
lib2sources = ['meson-sample2.c', 'meson-sample2.h']

girlib = shared_library(
'gir_lib',
Expand All @@ -9,6 +10,13 @@ girlib = shared_library(
install : true
)

girlib2 = shared_library(
'gir_lib2',
sources : lib2sources,
dependencies : [gobj],
install : true
)

girexe = executable(
'girprog',
sources : 'prog.c',
Expand All @@ -19,8 +27,8 @@ girexe = executable(
fake_dep = dependency('no-way-this-exists', required: false)

gnome.generate_gir(
girlib,
sources : libsources,
girlib, girlib2,
sources : libsources + lib2sources,
nsversion : '1.0',
namespace : 'Meson',
symbol_prefix : 'meson',
Expand Down
3 changes: 3 additions & 0 deletions test cases/frameworks/7 gnome/gir/prog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
dep1 = MesonDep1.Dep1.new()
dep2 = MesonDep2.Dep2.new("Hello, meson/py!")
s.print_message(dep1, dep2)

s2 = Meson.Sample2.new()
s2.print_message()