aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/frameworks/28 gir link order 2
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/frameworks/28 gir link order 2')
-rw-r--r--meson/test cases/frameworks/28 gir link order 2/meson-sample.c42
-rw-r--r--meson/test cases/frameworks/28 gir link order 2/meson-sample.h17
-rw-r--r--meson/test cases/frameworks/28 gir link order 2/meson.build35
-rw-r--r--meson/test cases/frameworks/28 gir link order 2/samelibname/meson.build5
4 files changed, 99 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/28 gir link order 2/meson-sample.c b/meson/test cases/frameworks/28 gir link order 2/meson-sample.c
new file mode 100644
index 000000000..d743b2d8b
--- /dev/null
+++ b/meson/test cases/frameworks/28 gir link order 2/meson-sample.c
@@ -0,0 +1,42 @@
+#include "meson-sample.h"
+
+struct _MesonSample {
+ GObject parent_instance;
+};
+
+G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT)
+
+/**
+ * meson_sample_new:
+ *
+ * Allocates a new #MesonSample.
+ *
+ * Returns: (transfer full): a #MesonSample.
+ */
+MesonSample *
+meson_sample_new (void)
+{
+ return g_object_new (MESON_TYPE_SAMPLE, NULL);
+}
+
+static void
+meson_sample_class_init (MesonSampleClass *klass)
+{
+}
+
+static void
+meson_sample_init (MesonSample *self)
+{
+}
+
+/**
+ * meson_sample_print_message:
+ * @self: a #MesonSample.
+ *
+ * Prints a message.
+ */
+void
+meson_sample_print_message (MesonSample *self)
+{
+ g_return_if_fail (MESON_IS_SAMPLE (self));
+}
diff --git a/meson/test cases/frameworks/28 gir link order 2/meson-sample.h b/meson/test cases/frameworks/28 gir link order 2/meson-sample.h
new file mode 100644
index 000000000..2c28401ec
--- /dev/null
+++ b/meson/test cases/frameworks/28 gir link order 2/meson-sample.h
@@ -0,0 +1,17 @@
+#ifndef MESON_SAMPLE_H
+#define MESON_SAMPLE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MESON_TYPE_SAMPLE (meson_sample_get_type())
+
+G_DECLARE_FINAL_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject)
+
+MesonSample *meson_sample_new (void);
+void meson_sample_print_message (MesonSample *self);
+
+G_END_DECLS
+
+#endif /* MESON_SAMPLE_H */
diff --git a/meson/test cases/frameworks/28 gir link order 2/meson.build b/meson/test cases/frameworks/28 gir link order 2/meson.build
new file mode 100644
index 000000000..a26531bce
--- /dev/null
+++ b/meson/test cases/frameworks/28 gir link order 2/meson.build
@@ -0,0 +1,35 @@
+project('gir link order 2', 'c')
+
+if not dependency('gobject-2.0', required : false).found() or not find_program('g-ir-scanner', required: false).found()
+ error('MESON_SKIP_TEST gobject not found.')
+endif
+
+gnome = import('gnome')
+gobject = dependency('gobject-2.0')
+
+# This builds a dummy libsample under samelibname that's not really used
+subdir('samelibname')
+
+# This builds the real libsample
+meson_sample_sources = ['meson-sample.c', 'meson-sample.h']
+meson_sample_lib = shared_library(
+ 'sample',
+ sources : meson_sample_sources,
+ dependencies : [gobject],
+ link_with: [samelibname],
+ install : false,
+)
+
+# g-ir-scanner should get the linker paths in the right order so it links first
+# against the target libsample and not the dummy one that's just a dependency
+# https://github.com/mesonbuild/meson/pull/5423
+gnome.generate_gir(
+ meson_sample_lib,
+ sources : meson_sample_sources,
+ nsversion : '1.0',
+ namespace : 'Meson',
+ symbol_prefix : 'meson',
+ identifier_prefix : 'Meson',
+ install : false,
+ build_by_default: true,
+)
diff --git a/meson/test cases/frameworks/28 gir link order 2/samelibname/meson.build b/meson/test cases/frameworks/28 gir link order 2/samelibname/meson.build
new file mode 100644
index 000000000..8850372f3
--- /dev/null
+++ b/meson/test cases/frameworks/28 gir link order 2/samelibname/meson.build
@@ -0,0 +1,5 @@
+samelibname = shared_library(
+ 'sample',
+ sources : [],
+ install : false,
+)