functions: revert the function init order to make pylint happy again. See #217
[pygobject.git] / tests / meson.build
blobf72ead0fd4094a17c922c90da05e14c04d5c5662
1 gnome = import('gnome')
3 host_system = host_machine.system()
5 cc = meson.get_compiler('c')
7 visibility_args = []
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']
16     endif
17   elif cc.has_argument('-fvisibility=hidden')
18     visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) extern']
19     visibility_args += ['-fvisibility=hidden']
20   endif
21 endif
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')]
30 else
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')
38 endif
40 marshalling_sources += ['gimarshallingtestsextra.c']
42 marshalling_headers += ['gimarshallingtestsextra.h']
44 marshalling_lib = library(
45   'gimarshallingtests',
46   sources : marshalling_sources,
47   dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep],
48   include_directories : regress_incdir,
49   c_args: visibility_args,
52 gnome.generate_gir(
53   marshalling_lib,
54   sources : marshalling_sources + marshalling_headers,
55   nsversion : '1.0',
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]
68 regress_c_args = []
70 if with_pycairo
71   regress_deps += [cairo_dep, cairo_gobject_dep]
72 else
73   regress_c_args += ['-D_GI_DISABLE_CAIRO']
74 endif
76 regress_lib = library(
77   'regress',
78   sources : regress_sources,
79   dependencies : regress_deps,
80   include_directories : regress_incdir,
81   c_args: regress_c_args + visibility_args,
84 gnome.generate_gir(
85   regress_lib,
86   sources : regress_sources + regress_headers,
87   nsversion : '1.0',
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,
95 helper_sources = [
96   'testhelpermodule.c',
97   'test-floating.c',
98   'test-thread.c',
99   'test-unknown.c']
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'))
113 endif
115 if host_machine.system() == 'linux'
116     envdata.prepend('LD_LIBRARY_PATH', meson.current_build_dir())
117 endif
118 if host_machine.system() == 'windows'
119     envdata.prepend('PATH', join_paths(get_option('prefix'), get_option('bindir')))
120 endif
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')]
125 endif
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')],
131   env : envdata,
132   timeout : 90)