parent
e542901af6
commit
b7ac8668f3
23 changed files with 928 additions and 20 deletions
@ -0,0 +1,6 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
import shutil |
||||
|
||||
shutil.copy(sys.argv[1], sys.argv[2]) |
@ -0,0 +1,18 @@ |
||||
#!/usr/bin/env python3 |
||||
# SPDX-License-Identifier: Apache-2.0 |
||||
# Copyright © 2021 Intel Corporation |
||||
|
||||
import argparse |
||||
import shutil |
||||
|
||||
def main() -> None: |
||||
parser = argparse.ArgumentParser() |
||||
parser.add_argument('src') |
||||
parser.add_argument('dest') |
||||
args = parser.parse_args() |
||||
|
||||
shutil.copy(args.src, args.dest) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
@ -0,0 +1,56 @@ |
||||
#include "dep1.h" |
||||
|
||||
struct _MesonDep1 |
||||
{ |
||||
GObject parent_instance; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonDep1, meson_dep1, G_TYPE_OBJECT) |
||||
|
||||
/**
|
||||
* meson_dep1_new: |
||||
* |
||||
* Allocates a new #MesonDep1. |
||||
* |
||||
* Returns: (transfer full): a #MesonDep1. |
||||
*/ |
||||
MesonDep1 * |
||||
meson_dep1_new (void) |
||||
{ |
||||
return g_object_new (MESON_TYPE_DEP1, NULL); |
||||
} |
||||
|
||||
static void |
||||
meson_dep1_finalize (GObject *object) |
||||
{ |
||||
G_OBJECT_CLASS (meson_dep1_parent_class)->finalize (object); |
||||
} |
||||
|
||||
static void |
||||
meson_dep1_class_init (MesonDep1Class *klass) |
||||
{ |
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
||||
|
||||
object_class->finalize = meson_dep1_finalize; |
||||
} |
||||
|
||||
static void |
||||
meson_dep1_init (MesonDep1 *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_dep1_just_return_it: |
||||
* @dep: a #MesonDep2. |
||||
* |
||||
* Returns the #MesonDep2 that is passed in |
||||
* |
||||
* Returns: (transfer none): a #MesonDep2 |
||||
*/ |
||||
MesonDep2* |
||||
meson_dep1_just_return_it (MesonDep1 *self, MesonDep2 *dep) |
||||
{ |
||||
g_return_val_if_fail (MESON_IS_DEP1 (self), NULL); |
||||
|
||||
return dep; |
||||
} |
@ -0,0 +1,23 @@ |
||||
#ifndef MESON_DEP1_H |
||||
#define MESON_DEP1_H |
||||
|
||||
#if !defined (MESON_TEST_1) |
||||
#error "MESON_TEST_1 not defined." |
||||
#endif |
||||
|
||||
#include <glib-object.h> |
||||
#include "dep2/dep2.h" |
||||
|
||||
G_BEGIN_DECLS |
||||
|
||||
#define MESON_TYPE_DEP1 (meson_dep1_get_type()) |
||||
|
||||
G_DECLARE_FINAL_TYPE (MesonDep1, meson_dep1, MESON, DEP1, GObject) |
||||
|
||||
MesonDep1 *meson_dep1_new (void); |
||||
MesonDep2 *meson_dep1_just_return_it (MesonDep1 *self, |
||||
MesonDep2 *dep); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_DEP1_H */ |
@ -0,0 +1,124 @@ |
||||
#include "dep2.h" |
||||
|
||||
struct _MesonDep2 |
||||
{ |
||||
GObject parent_instance; |
||||
|
||||
gchar *msg; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonDep2, meson_dep2, G_TYPE_OBJECT) |
||||
|
||||
enum { |
||||
PROP_0, |
||||
PROP_MSG, |
||||
LAST_PROP |
||||
}; |
||||
|
||||
static GParamSpec *gParamSpecs [LAST_PROP]; |
||||
|
||||
/**
|
||||
* meson_dep2_new: |
||||
* @msg: The message to set. |
||||
* |
||||
* Allocates a new #MesonDep2. |
||||
* |
||||
* Returns: (transfer full): a #MesonDep2. |
||||
*/ |
||||
MesonDep2 * |
||||
meson_dep2_new (const gchar *msg) |
||||
{ |
||||
g_return_val_if_fail (msg != NULL, NULL); |
||||
|
||||
return g_object_new (MESON_TYPE_DEP2, |
||||
"message", msg, |
||||
NULL); |
||||
} |
||||
|
||||
static void |
||||
meson_dep2_finalize (GObject *object) |
||||
{ |
||||
MesonDep2 *self = (MesonDep2 *)object; |
||||
|
||||
g_clear_pointer (&self->msg, g_free); |
||||
|
||||
G_OBJECT_CLASS (meson_dep2_parent_class)->finalize (object); |
||||
} |
||||
|
||||
static void |
||||
meson_dep2_get_property (GObject *object, |
||||
guint prop_id, |
||||
GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonDep2 *self = MESON_DEP2 (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_dep2_set_property (GObject *object, |
||||
guint prop_id, |
||||
const GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonDep2 *self = MESON_DEP2 (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_dep2_class_init (MesonDep2Class *klass) |
||||
{ |
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
||||
|
||||
object_class->finalize = meson_dep2_finalize; |
||||
object_class->get_property = meson_dep2_get_property; |
||||
object_class->set_property = meson_dep2_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_dep2_init (MesonDep2 *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_dep2_return_message: |
||||
* @self: a #MesonDep2. |
||||
* |
||||
* Returns the message. |
||||
* |
||||
* Returns: (transfer none): a const gchar* |
||||
*/ |
||||
const gchar* |
||||
meson_dep2_return_message (MesonDep2 *self) |
||||
{ |
||||
g_return_val_if_fail (MESON_IS_DEP2 (self), NULL); |
||||
|
||||
return (const gchar*) self->msg; |
||||
} |
@ -0,0 +1,21 @@ |
||||
#ifndef MESON_DEP2_H |
||||
#define MESON_DEP2_H |
||||
|
||||
#if !defined (MESON_TEST_1) |
||||
#error "MESON_TEST_1 not defined." |
||||
#endif |
||||
|
||||
#include <glib-object.h> |
||||
|
||||
G_BEGIN_DECLS |
||||
|
||||
#define MESON_TYPE_DEP2 (meson_dep2_get_type()) |
||||
|
||||
G_DECLARE_FINAL_TYPE (MesonDep2, meson_dep2, MESON, DEP2, GObject) |
||||
|
||||
MesonDep2 *meson_dep2_new (const gchar *msg); |
||||
const gchar *meson_dep2_return_message (MesonDep2 *self); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_DEP2_H */ |
@ -0,0 +1,23 @@ |
||||
dep2sources = ['dep2.c', 'dep2.h'] |
||||
|
||||
dep2lib = shared_library( |
||||
'dep2lib', |
||||
sources : dep2sources, |
||||
dependencies : gobj, |
||||
install : true |
||||
) |
||||
|
||||
dep2gir = gnome.generate_gir( |
||||
dep2lib, |
||||
sources : dep2sources, |
||||
nsversion : '1.0', |
||||
namespace : 'MesonDep2', |
||||
symbol_prefix : 'meson', |
||||
identifier_prefix : 'Meson', |
||||
includes : ['GObject-2.0'], |
||||
install : true, |
||||
use_gi_repository_compile: true |
||||
) |
||||
|
||||
dep2_dep = declare_dependency(link_with : dep2lib, |
||||
sources : [dep2gir]) |
@ -0,0 +1,124 @@ |
||||
#include "dep3.h" |
||||
|
||||
struct _MesonDep3 |
||||
{ |
||||
GObject parent_instance; |
||||
|
||||
gchar *msg; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonDep3, meson_dep3, G_TYPE_OBJECT) |
||||
|
||||
enum { |
||||
PROP_0, |
||||
PROP_MSG, |
||||
LAST_PROP |
||||
}; |
||||
|
||||
static GParamSpec *gParamSpecs [LAST_PROP]; |
||||
|
||||
/**
|
||||
* meson_dep3_new: |
||||
* @msg: The message to set. |
||||
* |
||||
* Allocates a new #MesonDep3. |
||||
* |
||||
* Returns: (transfer full): a #MesonDep3. |
||||
*/ |
||||
MesonDep3 * |
||||
meson_dep3_new (const gchar *msg) |
||||
{ |
||||
g_return_val_if_fail (msg != NULL, NULL); |
||||
|
||||
return g_object_new (MESON_TYPE_DEP3, |
||||
"message", msg, |
||||
NULL); |
||||
} |
||||
|
||||
static void |
||||
meson_dep3_finalize (GObject *object) |
||||
{ |
||||
MesonDep3 *self = (MesonDep3 *)object; |
||||
|
||||
g_clear_pointer (&self->msg, g_free); |
||||
|
||||
G_OBJECT_CLASS (meson_dep3_parent_class)->finalize (object); |
||||
} |
||||
|
||||
static void |
||||
meson_dep3_get_property (GObject *object, |
||||
guint prop_id, |
||||
GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonDep3 *self = MESON_DEP3 (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_dep3_set_property (GObject *object, |
||||
guint prop_id, |
||||
const GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonDep3 *self = MESON_DEP3 (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_dep3_class_init (MesonDep3Class *klass) |
||||
{ |
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
||||
|
||||
object_class->finalize = meson_dep3_finalize; |
||||
object_class->get_property = meson_dep3_get_property; |
||||
object_class->set_property = meson_dep3_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_dep3_init (MesonDep3 *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_dep3_return_message: |
||||
* @self: a #MesonDep3. |
||||
* |
||||
* Returns the message. |
||||
* |
||||
* Returns: (transfer none): a const gchar* |
||||
*/ |
||||
const gchar* |
||||
meson_dep3_return_message (MesonDep3 *self) |
||||
{ |
||||
g_return_val_if_fail (MESON_IS_DEP3 (self), NULL); |
||||
|
||||
return (const gchar*) self->msg; |
||||
} |
@ -0,0 +1,21 @@ |
||||
#ifndef MESON_DEP3_H |
||||
#define MESON_DEP3_H |
||||
|
||||
#if !defined (MESON_TEST_1) |
||||
#error "MESON_TEST_1 not defined." |
||||
#endif |
||||
|
||||
#include <glib-object.h> |
||||
|
||||
G_BEGIN_DECLS |
||||
|
||||
#define MESON_TYPE_DEP3 (meson_dep3_get_type()) |
||||
|
||||
G_DECLARE_FINAL_TYPE (MesonDep3, meson_dep3, MESON, DEP3, GObject) |
||||
|
||||
MesonDep3 *meson_dep3_new (const gchar *msg); |
||||
const gchar *meson_dep3_return_message (MesonDep3 *self); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_DEP3_H */ |
@ -0,0 +1,23 @@ |
||||
dep3sources = ['dep3.c', 'dep3.h'] |
||||
|
||||
dep3lib = shared_library( |
||||
'dep3lib', |
||||
sources : dep3sources, |
||||
dependencies : gobj, |
||||
install : true |
||||
) |
||||
|
||||
dep3gir = gnome.generate_gir( |
||||
dep3lib, |
||||
sources : dep3sources, |
||||
nsversion : '1.0', |
||||
namespace : 'MesonDep3', |
||||
symbol_prefix : 'meson', |
||||
identifier_prefix : 'Meson', |
||||
includes : ['GObject-2.0'], |
||||
install : true, |
||||
use_gi_repository_compile: true |
||||
) |
||||
|
||||
dep3_dep = declare_dependency(link_with : dep3lib, |
||||
sources : [dep3gir]) |
@ -0,0 +1,32 @@ |
||||
subdir('dep2') |
||||
subdir('dep3') |
||||
|
||||
dep1sources = ['dep1.c', 'dep1.h'] |
||||
|
||||
# Do not need to link to dep2lib because we don't use any symbols from it |
||||
dep1lib = shared_library( |
||||
'dep1lib', |
||||
sources : dep1sources, |
||||
dependencies : gobj, |
||||
install : true |
||||
) |
||||
|
||||
# But the gir does need it because it we use the MesonDep2* structure defined |
||||
# in the header |
||||
dep1gir = gnome.generate_gir( |
||||
dep1lib, |
||||
sources : dep1sources, |
||||
nsversion : '1.0', |
||||
namespace : 'MesonDep1', |
||||
symbol_prefix : 'meson', |
||||
identifier_prefix : 'Meson', |
||||
header: 'dep1.h', |
||||
includes : ['GObject-2.0', 'MesonDep2-1.0', dep3gir[0]], |
||||
dependencies : [dep2_dep], |
||||
install : true, |
||||
use_gi_repository_compile: true |
||||
) |
||||
|
||||
dep1_dep = declare_dependency(link_with : dep1lib, |
||||
dependencies : [dep2_dep, dep3_dep], |
||||
sources : [dep1gir]) |
@ -0,0 +1,121 @@ |
||||
#include "meson-sample.h" |
||||
|
||||
struct _MesonSample |
||||
{ |
||||
GObject parent_instance; |
||||
|
||||
gchar *msg; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT) |
||||
|
||||
enum { |
||||
PROP_0, |
||||
PROP_MSG, |
||||
LAST_PROP |
||||
}; |
||||
|
||||
static GParamSpec *gParamSpecs [LAST_PROP]; |
||||
|
||||
/**
|
||||
* 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_finalize (GObject *object) |
||||
{ |
||||
MesonSample *self = (MesonSample *)object; |
||||
|
||||
g_clear_pointer (&self->msg, g_free); |
||||
|
||||
G_OBJECT_CLASS (meson_sample_parent_class)->finalize (object); |
||||
} |
||||
|
||||
static void |
||||
meson_sample_get_property (GObject *object, |
||||
guint prop_id, |
||||
GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonSample *self = MESON_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_sample_set_property (GObject *object, |
||||
guint prop_id, |
||||
const GValue *value, |
||||
GParamSpec *pspec) |
||||
{ |
||||
MesonSample *self = MESON_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_sample_class_init (MesonSampleClass *klass) |
||||
{ |
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
||||
|
||||
object_class->finalize = meson_sample_finalize; |
||||
object_class->get_property = meson_sample_get_property; |
||||
object_class->set_property = meson_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_sample_init (MesonSample *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_sample_print_message: |
||||
* @self: a #MesonSample. |
||||
* |
||||
* Prints the message. |
||||
* |
||||
* Returns: Nothing. |
||||
*/ |
||||
void |
||||
meson_sample_print_message (MesonSample *self, MesonDep1 *dep1, MesonDep2 *dep2) |
||||
{ |
||||
MesonDep2 *samedep; |
||||
g_return_if_fail (MESON_IS_SAMPLE (self)); |
||||
|
||||
samedep = meson_dep1_just_return_it (dep1, dep2); |
||||
g_print ("Message: %s\n", meson_dep2_return_message (samedep)); |
||||
} |
@ -0,0 +1,28 @@ |
||||
#ifndef MESON_SAMPLE_H |
||||
#define MESON_SAMPLE_H |
||||
|
||||
#if !defined (MESON_TEST_1) |
||||
#error "MESON_TEST_1 not defined." |
||||
#endif |
||||
|
||||
#if !defined (MESON_TEST_2) |
||||
#error "MESON_TEST_2 not defined." |
||||
#endif |
||||
|
||||
#include <glib-object.h> |
||||
#include "dep1/dep1.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, |
||||
MesonDep1 *dep1, |
||||
MesonDep2 *dep2); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_SAMPLE_H */ |
@ -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"); |
||||
} |
@ -0,0 +1,21 @@ |
||||
#ifndef MESON_SAMPLE2_H |
||||
#define MESON_SAMPLE2_H |
||||
|
||||
#if !defined (MESON_TEST_1) |
||||
#error "MESON_TEST_1 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 */ |
@ -0,0 +1,64 @@ |
||||
subdir('dep1') |
||||
|
||||
libsources = ['meson-sample.c', 'meson-sample.h'] |
||||
lib2sources = ['meson-sample2.c', 'meson-sample2.h'] |
||||
|
||||
gen_source = custom_target( |
||||
'meson_sample3.h', |
||||
input : 'meson-sample.h', |
||||
output : 'meson-sample3.h', |
||||
command : [find_program('copy.py'), '@INPUT@', '@OUTPUT@'], |
||||
build_by_default : false, # this will force a race condition if one exists |
||||
) |
||||
|
||||
girlib = shared_library( |
||||
'gir_lib', |
||||
sources : libsources, |
||||
c_args: '-DMESON_TEST_2', |
||||
dependencies : [gobj, dep1_dep], |
||||
install : true |
||||
) |
||||
|
||||
girlib2 = shared_library( |
||||
'gir_lib2', |
||||
sources : lib2sources, |
||||
dependencies : [gobj], |
||||
install : true |
||||
) |
||||
|
||||
girexe = executable( |
||||
'girprog', |
||||
sources : 'prog.c', |
||||
c_args: '-DMESON_TEST_2', |
||||
dependencies : [glib, gobj, gir, dep1_dep], |
||||
link_with : girlib |
||||
) |
||||
|
||||
fake_dep = dependency('no-way-this-exists', required: false) |
||||
|
||||
gnome.generate_gir( |
||||
girlib, girlib2, |
||||
sources : [libsources, lib2sources, gen_source], |
||||
env : {'CPPFLAGS': '-DMESON_TEST_2'}, |
||||
nsversion : '1.0', |
||||
namespace : 'Meson', |
||||
symbol_prefix : 'meson', |
||||
identifier_prefix : 'Meson', |
||||
includes : ['GObject-2.0', 'MesonDep1-1.0'], |
||||
# dep1_dep pulls in dep2_dep for us |
||||
dependencies : [[fake_dep, dep1_dep]], |
||||
install : true, |
||||
build_by_default : true, |
||||
use_gi_repository_compile: true |
||||
) |
||||
|
||||
test('gobject introspection/c', girexe) |
||||
gir_paths = ':'.join([girlib.outdir(), dep1lib.outdir(), dep2lib.outdir(), dep3lib.outdir()]) |
||||
envdata = environment() |
||||
envdata.append('GI_TYPELIB_PATH', gir_paths, separator : ':') |
||||
envdata.append('LD_LIBRARY_PATH', gir_paths) |
||||
if ['windows', 'cygwin'].contains(host_machine.system()) |
||||
envdata.append('PATH', gir_paths) |
||||
endif |
||||
test('gobject introspection/py', find_program('prog.py'), |
||||
env : envdata) |
@ -0,0 +1,35 @@ |
||||
#include <girepository.h> |
||||
|
||||
#include "meson-sample.h" |
||||
|
||||
gint |
||||
main (gint argc, |
||||
gchar *argv[]) |
||||
{ |
||||
GError * error = NULL; |
||||
|
||||
GOptionContext * ctx = g_option_context_new (NULL); |
||||
g_option_context_add_group (ctx, g_irepository_get_option_group ()); |
||||
|
||||
if (!g_option_context_parse (ctx, &argc, &argv, &error)) { |
||||
g_print ("sample: %s\n", error->message); |
||||
g_option_context_free (ctx); |
||||
if (error) { |
||||
g_error_free (error); |
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
MesonSample * i = meson_sample_new (); |
||||
MesonDep1 * dep1 = meson_dep1_new (); |
||||
MesonDep2 * dep2 = meson_dep2_new ("Hello, meson/c!"); |
||||
meson_sample_print_message (i, dep1, dep2); |
||||
|
||||
g_object_unref (i); |
||||
g_object_unref (dep1); |
||||
g_object_unref (dep2); |
||||
g_option_context_free (ctx); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,11 @@ |
||||
#!/usr/bin/env python3 |
||||
from gi.repository import Meson, MesonDep1, MesonDep2 |
||||
|
||||
if __name__ == "__main__": |
||||
s = Meson.Sample.new() |
||||
dep1 = MesonDep1.Dep1.new() |
||||
dep2 = MesonDep2.Dep2.new("Hello, meson/py!") |
||||
s.print_message(dep1, dep2) |
||||
|
||||
s2 = Meson.Sample2.new() |
||||
s2.print_message() |
@ -0,0 +1,66 @@ |
||||
project('gobject-introspection', 'c') |
||||
|
||||
copyfile = find_program('copyfile.py') |
||||
copyfile_gen = generator(copyfile, |
||||
output: '@BASENAME@Gen.xml', |
||||
arguments : ['@INPUT@', '@OUTPUT@']) |
||||
|
||||
glib = dependency('glib-2.0', required: false) |
||||
if not glib.found() |
||||
error('MESON_SKIP_TEST glib not found.') |
||||
endif |
||||
|
||||
gir = dependency('gobject-introspection-1.0', required: false) |
||||
if not gir.found() |
||||
error('MESON_SKIP_TEST gobject-introspection not found.') |
||||
endif |
||||
|
||||
python3 = import('python3') |
||||
py3 = python3.find_python() |
||||
if run_command(py3, '-c', 'import gi;', check: false).returncode() != 0 |
||||
error('MESON_SKIP_TEST python3-gi not found') |
||||
endif |
||||
|
||||
cc = meson.get_compiler('c') |
||||
|
||||
add_global_arguments('-DMESON_TEST_1', language : 'c') |
||||
if cc.get_id() == 'intel' |
||||
# Ignore invalid GCC pragma warnings from glib |
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=776562 |
||||
add_global_arguments('-wd2282', language : 'c') |
||||
endif |
||||
|
||||
py3 = import('python3').find_python() |
||||
pycode = '''import os, sys |
||||
if "MESON_UNIT_TEST_PRETEND_GLIB_OLD" in os.environ: |
||||
sys.exit(0) |
||||
sys.exit(1) |
||||
''' |
||||
|
||||
pretend_glib_old = false |
||||
res = run_command(py3, '-c', pycode, check: false) |
||||
if res.returncode() == 0 |
||||
pretend_glib_old = true |
||||
endif |
||||
|
||||
gnome = import('gnome') |
||||
gio = dependency('gio-2.0') |
||||
giounix = dependency('gio-unix-2.0') |
||||
glib = dependency('glib-2.0') |
||||
gobj = dependency('gobject-2.0') |
||||
gir = dependency('gobject-introspection-1.0') |
||||
gmod = dependency('gmodule-2.0') |
||||
|
||||
# GLib >= 2.76 removed slice allocator which causes a leak in g-i to now be |
||||
# visible to asan. The leak should be fixed in g-i >= 1.76.2: |
||||
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/411 |
||||
if get_option('b_sanitize') != 'none' and \ |
||||
gir.version().version_compare('<=1.76.1') and \ |
||||
glib.version().version_compare('>=2.76') |
||||
error('MESON_SKIP_TEST gobject-introspection >=1.76.2 is required with address sanitizer.') |
||||
endif |
||||
|
||||
# Test that static deps don't error out when static libraries aren't found |
||||
glib_static = dependency('glib-2.0', static : true) |
||||
|
||||
subdir('gir') |
@ -0,0 +1,23 @@ |
||||
{ |
||||
"installed": [ |
||||
{"type": "expr", "file": "usr/lib/?libgir_lib.so"}, |
||||
{"type": "file", "platform": "cygwin", "file": "usr/lib/libgir_lib.dll.a"}, |
||||
{"type": "expr", "file": "usr/lib/?libgir_lib2.so"}, |
||||
{"type": "file", "platform": "cygwin", "file": "usr/lib/libgir_lib2.dll.a"}, |
||||
{"type": "expr", "file": "usr/lib/?libdep1lib.so"}, |
||||
{"type": "file", "platform": "cygwin", "file": "usr/lib/libdep1lib.dll.a"}, |
||||
{"type": "expr", "file": "usr/lib/?libdep2lib.so"}, |
||||
{"type": "file", "platform": "cygwin", "file": "usr/lib/libdep2lib.dll.a"}, |
||||
{"type": "expr", "file": "usr/lib/?libdep3lib.so"}, |
||||
{"type": "file", "platform": "cygwin", "file": "usr/lib/libdep3lib.dll.a"}, |
||||
{"type": "file", "file": "usr/lib/girepository-1.0/Meson-1.0.typelib"}, |
||||
{"type": "file", "file": "usr/lib/girepository-1.0/MesonDep1-1.0.typelib"}, |
||||
{"type": "file", "file": "usr/lib/girepository-1.0/MesonDep2-1.0.typelib"}, |
||||
{"type": "file", "file": "usr/lib/girepository-1.0/MesonDep3-1.0.typelib"}, |
||||
{"type": "file", "file": "usr/share/gir-1.0/Meson-1.0.gir"}, |
||||
{"type": "file", "file": "usr/share/gir-1.0/MesonDep1-1.0.gir"}, |
||||
{"type": "file", "file": "usr/share/gir-1.0/MesonDep2-1.0.gir"}, |
||||
{"type": "file", "file": "usr/share/gir-1.0/MesonDep3-1.0.gir"} |
||||
], |
||||
"expect_skip_on_jobname": ["azure", "cygwin", "macos", "msys2", "pypy", "bionic"] |
||||
} |
Loading…
Reference in new issue