aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/frameworks/34 gir static lib/subdir/gir
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/frameworks/34 gir static lib/subdir/gir')
-rw-r--r--meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.c124
-rw-r--r--meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.h17
-rw-r--r--meson/test cases/frameworks/34 gir static lib/subdir/gir/meson.build28
-rw-r--r--meson/test cases/frameworks/34 gir static lib/subdir/gir/prog.c12
4 files changed, 181 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.c b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.c
new file mode 100644
index 000000000..2d58a1039
--- /dev/null
+++ b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.c
@@ -0,0 +1,124 @@
+#include "meson-subsample.h"
+
+struct _MesonSubSample
+{
+ MesonSample parent_instance;
+
+ gchar *msg;
+};
+
+G_DEFINE_TYPE (MesonSubSample, meson_sub_sample, MESON_TYPE_SAMPLE)
+
+enum {
+ PROP_0,
+ PROP_MSG,
+ LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+/**
+ * meson_sub_sample_new:
+ * @msg: The message to set.
+ *
+ * Allocates a new #MesonSubSample.
+ *
+ * Returns: (transfer full): a #MesonSubSample.
+ */
+MesonSubSample *
+meson_sub_sample_new (const gchar *msg)
+{
+ g_return_val_if_fail (msg != NULL, NULL);
+
+ return g_object_new (MESON_TYPE_SUB_SAMPLE,
+ "message", msg,
+ NULL);
+}
+
+static void
+meson_sub_sample_finalize (GObject *object)
+{
+ MesonSubSample *self = (MesonSubSample *)object;
+
+ g_clear_pointer (&self->msg, g_free);
+
+ G_OBJECT_CLASS (meson_sub_sample_parent_class)->finalize (object);
+}
+
+static void
+meson_sub_sample_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ MesonSubSample *self = MESON_SUB_SAMPLE (object);
+
+ switch (prop_id)
+ {
+ case PROP_MSG:
+ g_value_set_string (value, self->msg);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+meson_sub_sample_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MesonSubSample *self = MESON_SUB_SAMPLE (object);
+
+ switch (prop_id)
+ {
+ case PROP_MSG:
+ self->msg = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+meson_sub_sample_class_init (MesonSubSampleClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = meson_sub_sample_finalize;
+ object_class->get_property = meson_sub_sample_get_property;
+ object_class->set_property = meson_sub_sample_set_property;
+
+ gParamSpecs [PROP_MSG] =
+ g_param_spec_string ("message",
+ "Message",
+ "The message to print.",
+ NULL,
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
+}
+
+static void
+meson_sub_sample_init (MesonSubSample *self)
+{
+}
+
+/**
+ * meson_sub_sample_print_message:
+ * @self: a #MesonSubSample.
+ *
+ * Prints the message.
+ *
+ * Returns: Nothing.
+ */
+void
+meson_sub_sample_print_message (MesonSubSample *self)
+{
+ g_return_if_fail (MESON_IS_SUB_SAMPLE (self));
+
+ g_print ("Message: %s\n", self->msg);
+}
diff --git a/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.h b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.h
new file mode 100644
index 000000000..9d34a0824
--- /dev/null
+++ b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.h
@@ -0,0 +1,17 @@
+#ifndef MESON_SUB_SAMPLE_H
+#define MESON_SUB_SAMPLE_H
+
+#include <glib-object.h>
+#include <meson-sample.h>
+
+G_BEGIN_DECLS
+
+#define MESON_TYPE_SUB_SAMPLE (meson_sub_sample_get_type())
+
+G_DECLARE_FINAL_TYPE (MesonSubSample, meson_sub_sample, MESON, SUB_SAMPLE, MesonSample)
+
+MesonSubSample *meson_sub_sample_new (const gchar *msg);
+
+G_END_DECLS
+
+#endif /* MESON_SUB_SAMPLE_H */
diff --git a/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson.build b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson.build
new file mode 100644
index 000000000..b26f04e47
--- /dev/null
+++ b/meson/test cases/frameworks/34 gir static lib/subdir/gir/meson.build
@@ -0,0 +1,28 @@
+libsources = ['meson-subsample.c', 'meson-subsample.h']
+
+girlib = shared_library(
+ 'girlib',
+ sources : libsources,
+ dependencies : [gobj, statichelper_dep],
+ install : true
+)
+
+girexe = executable(
+ 'girprog',
+ sources : 'prog.c',
+ dependencies : [gobj, statichelper_dep],
+ link_with : girlib
+)
+
+gnome.generate_gir(
+ girlib, statichelper_lib,
+ sources : [ libsources, statichelper_sources ],
+ nsversion : '1.0',
+ namespace : 'Meson',
+ symbol_prefix : 'meson_',
+ identifier_prefix : 'Meson',
+ includes : ['GObject-2.0'],
+ install : true
+)
+
+test('gobject introspection/subproject/c', girexe)
diff --git a/meson/test cases/frameworks/34 gir static lib/subdir/gir/prog.c b/meson/test cases/frameworks/34 gir static lib/subdir/gir/prog.c
new file mode 100644
index 000000000..f25c9d85c
--- /dev/null
+++ b/meson/test cases/frameworks/34 gir static lib/subdir/gir/prog.c
@@ -0,0 +1,12 @@
+#include "meson-subsample.h"
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ MesonSample * i = (MesonSample*) meson_sub_sample_new ("Hello, sub/meson/c!");
+ meson_sample_print_message (i);
+ g_object_unref (i);
+
+ return 0;
+}