1 gnome = import('gnome')
3 host_system = host_machine.system()
5 cc = meson.get_compiler('c')
8 if get_option('default_library') != 'static'
9 if host_system == 'windows'
10 visibility_args += ['-DDLL_EXPORT']
11 if cc.get_id() == 'msvc'
12 visibility_args += ['-D_GI_EXTERN=__declspec(dllexport) extern']
13 elif cc.has_argument('-fvisibility=hidden')
14 visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) __declspec(dllexport) extern']
15 visibility_args += ['-fvisibility=hidden']
17 elif cc.has_argument('-fvisibility=hidden')
18 visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) extern']
19 visibility_args += ['-fvisibility=hidden']
23 if gi_dep.type_name() == 'pkgconfig'
24 gi_datadir = gi_dep.get_pkgconfig_variable('gidatadir')
25 regress_sources = [join_paths(gi_datadir, 'tests', 'regress.c')]
26 regress_headers = [join_paths(gi_datadir, 'tests', 'regress.h')]
27 regress_incdir = include_directories(join_paths(gi_datadir, 'tests'))
28 marshalling_sources = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.c')]
29 marshalling_headers = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.h')]
31 gi_subproject = subproject('gobject-introspection')
32 regress_sources = gi_subproject.get_variable('test_regress_sources')
33 regress_headers = gi_subproject.get_variable('test_regress_headers')
34 regress_incdir = gi_subproject.get_variable('test_regress_incdirs')
35 marshalling_sources = gi_subproject.get_variable('test_marshalling_sources')
36 marshalling_headers = gi_subproject.get_variable('test_marshalling_headers')
37 gi_datadir = join_paths(meson.source_root(), 'subprojects', 'gobject-introspection', 'tests')
40 marshalling_sources += ['gimarshallingtestsextra.c']
42 marshalling_headers += ['gimarshallingtestsextra.h']
44 marshalling_lib = library(
46 sources : marshalling_sources,
47 dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep],
48 include_directories : regress_incdir,
49 c_args: visibility_args,
54 sources : marshalling_sources + marshalling_headers,
56 namespace : 'GIMarshallingTests',
57 dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep],
58 symbol_prefix : 'gi_marshalling_tests',
59 includes : ['Gio-2.0'],
60 build_by_default : true,
63 regress_sources += ['regressextra.c']
65 regress_headers += ['regressextra.h']
67 regress_deps = [glib_dep, gobject_dep, gio_dep, gmodule_dep]
71 regress_deps += [cairo_dep, cairo_gobject_dep]
73 regress_c_args += ['-D_GI_DISABLE_CAIRO']
76 regress_lib = library(
78 sources : regress_sources,
79 dependencies : regress_deps,
80 include_directories : regress_incdir,
81 c_args: regress_c_args + visibility_args,
86 sources : regress_sources + regress_headers,
88 namespace : 'Regress',
89 includes : ['Gio-2.0', 'cairo-1.0'],
90 build_by_default : true,
91 dependencies : regress_deps,
92 extra_args: regress_c_args,
101 helperext = python.extension_module('testhelper', helper_sources,
102 dependencies : [python_dep, glib_dep, gobject_dep],
103 c_args: pyext_c_args + main_c_args,
104 include_directories: include_directories(join_paths('..', 'gi'))
107 schemas = gnome.compile_schemas(build_by_default: true)
109 envdata = environment()
110 envdata.append('GI_TYPELIB_PATH', meson.current_build_dir())
111 if gi_dep.type_name() == 'internal'
112 envdata.append('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'subprojects', 'gobject-introspection', 'gir'))
115 if host_machine.system() == 'linux'
116 envdata.prepend('LD_LIBRARY_PATH', meson.current_build_dir())
118 if host_machine.system() == 'windows'
119 envdata.prepend('PATH', join_paths(get_option('prefix'), get_option('bindir')))
122 python_paths = [join_paths(meson.current_build_dir(), '..')]
123 if with_pycairo and pycairo_dep.type_name() == 'internal'
124 python_paths += [join_paths(meson.build_root(), 'subprojects', 'pycairo')]
126 envdata.append('PYTHONPATH', python_paths)
127 envdata.append('TESTS_BUILDDIR', meson.current_build_dir())
129 test('pygobject-test-suite', python,
130 args : [join_paths(meson.current_source_dir(), 'runtests.py')],