| 1 |
project('Meson integration with dub.json', 'd') |
| 2 |
|
| 3 |
dub_exe = find_program('dub', required : false) |
| 4 |
if not dub_exe.found() |
| 5 |
error('MESON_SKIP_TEST: Dub not found') |
| 6 |
endif |
| 7 |
|
| 8 |
dub_ver = dub_exe.version() |
| 9 |
if not dub_ver.version_compare('>=1.35.0') |
| 10 |
error('MESON_SKIP_TEST: test requires dub >=1.35.0') |
| 11 |
endif |
| 12 |
|
| 13 |
# Multiple versions supported |
| 14 |
urld = dependency('urld', method: 'dub', version: [ '>=3.0.0', '<3.0.1' ]) |
| 15 |
|
| 16 |
# The version we got is the one in dub.selections.json |
| 17 |
version = urld.version() |
| 18 |
if version != '3.0.0' |
| 19 |
error(f'Expected urld version to be the one selected in dub.selections.json but got @version@') |
| 20 |
endif |
| 21 |
|
| 22 |
# dependency calls from subdirectories respect meson.project_source_root()/dub.selections.json |
| 23 |
subdir('x/y/z') |
| 24 |
|
| 25 |
# dependencies respect their configuration selected in dub.json |
| 26 |
run_command(dub_exe, 'build', '--deep', ':multi-configuration', |
| 27 |
'--compiler', meson.get_compiler('d').cmd_array()[0], |
| 28 |
'--arch', host_machine.cpu_family(), |
| 29 |
'--root', meson.project_source_root(), |
| 30 |
'--config', 'lib', |
| 31 |
check: true) |
| 32 |
found = dependency('17-dub-meson-project:multi-configuration', method: 'dub') |