| 1 |
subdir('dep1') |
| 2 |
|
| 3 |
libsources = ['meson-sample.c', 'meson-sample.h'] |
| 4 |
lib2sources = ['meson-sample2.c', 'meson-sample2.h'] |
| 5 |
pythonsources = ['meson-python-sample.c', 'meson-python-sample.h'] |
| 6 |
|
| 7 |
gen_source = custom_target( |
| 8 |
'meson_sample3.h', |
| 9 |
input : 'meson-sample.h', |
| 10 |
output : 'meson-sample3.h', |
| 11 |
command : [find_program('copy.py'), '@INPUT@', '@OUTPUT@'], |
| 12 |
build_by_default : false, # this will force a race condition if one exists |
| 13 |
) |
| 14 |
|
| 15 |
girlib = shared_library( |
| 16 |
'gir_lib', |
| 17 |
sources : libsources, |
| 18 |
c_args: '-DMESON_TEST_2', |
| 19 |
dependencies : [gobj, dep1_dep], |
| 20 |
install : true |
| 21 |
) |
| 22 |
|
| 23 |
girlib2 = shared_library( |
| 24 |
'gir_lib2', |
| 25 |
sources : lib2sources, |
| 26 |
dependencies : [gobj], |
| 27 |
install : true |
| 28 |
) |
| 29 |
|
| 30 |
if get_option('b_sanitize') == 'none' |
| 31 |
py3_dep = py3.dependency(embed: true) |
| 32 |
else |
| 33 |
warning('Python 3 test not supported with b_sanitize') |
| 34 |
py3_dep = disabler() |
| 35 |
endif |
| 36 |
|
| 37 |
if py3_dep.found() |
| 38 |
pythongirlib = shared_library( |
| 39 |
'python_gir_lib', |
| 40 |
sources: pythonsources, |
| 41 |
dependencies: [gobj, py3_dep], |
| 42 |
vs_module_defs: 'meson-python-sample.def', |
| 43 |
install: true |
| 44 |
) |
| 45 |
endif |
| 46 |
|
| 47 |
girexe = executable( |
| 48 |
'girprog', |
| 49 |
sources : 'prog.c', |
| 50 |
c_args: '-DMESON_TEST_2', |
| 51 |
dependencies : [glib, gobj, gir, dep1_dep], |
| 52 |
link_with : girlib |
| 53 |
) |
| 54 |
|
| 55 |
fake_dep = dependency('no-way-this-exists', required: false) |
| 56 |
|
| 57 |
# g-ir-scanner ignores CFLAGS for MSVC |
| 58 |
flags_dep_for_msvc = declare_dependency( |
| 59 |
compile_args: ['-DMESON_TEST_2'] |
| 60 |
) |
| 61 |
|
| 62 |
girs = [girlib, girlib2] |
| 63 |
girs_sources = [libsources, lib2sources, gen_source] |
| 64 |
# dep1_dep pulls in dep2_dep for us |
| 65 |
girs_deps = [fake_dep, dep1_dep, flags_dep_for_msvc] |
| 66 |
if py3_dep.found() |
| 67 |
girs += [pythongirlib] |
| 68 |
girs_sources += [pythonsources] |
| 69 |
girs_deps += [py3_dep] |
| 70 |
endif |
| 71 |
|
| 72 |
gnome.generate_gir( |
| 73 |
girs, |
| 74 |
sources : girs_sources, |
| 75 |
nsversion : '1.0', |
| 76 |
namespace : 'Meson', |
| 77 |
symbol_prefix : 'meson', |
| 78 |
identifier_prefix : 'Meson', |
| 79 |
includes : ['GObject-2.0', 'MesonDep1-1.0'], |
| 80 |
dependencies : girs_deps, |
| 81 |
doc_format: 'gtk-doc-markdown', |
| 82 |
install : true, |
| 83 |
build_by_default : true, |
| 84 |
) |
| 85 |
|
| 86 |
test('gobject introspection/c', girexe) |
| 87 |
gir_paths = ':'.join([girlib.outdir(), dep1lib.outdir(), dep2lib.outdir(), dep3lib.outdir()]) |
| 88 |
envdata = environment() |
| 89 |
envdata.append('GI_TYPELIB_PATH', gir_paths, separator : ':') |
| 90 |
envdata.append('LD_LIBRARY_PATH', gir_paths) |
| 91 |
if ['windows', 'cygwin'].contains(host_machine.system()) |
| 92 |
envdata.append('PATH', gir_paths) |
| 93 |
endif |
| 94 |
test('gobject introspection/py', find_program('prog.py'), |
| 95 |
env : envdata) |