| 1 |
project('structured input', 'rust') |
| 2 |
|
| 3 |
foo_mod_rs = configure_file( |
| 4 |
input : 'src/foo.rs.in', |
| 5 |
output : 'mod.rs', |
| 6 |
configuration : {'message' : 'Hello, World!'}, |
| 7 |
) |
| 8 |
|
| 9 |
conf_file = executable( |
| 10 |
'main_conf_file', |
| 11 |
structured_sources( |
| 12 |
'src/main.rs', |
| 13 |
{'foo' : [foo_mod_rs]}, |
| 14 |
), |
| 15 |
) |
| 16 |
|
| 17 |
ct = custom_target( |
| 18 |
'foo.rs', |
| 19 |
output : 'foo.rs', |
| 20 |
command : ['gen.py', '@OUTPUT@'], |
| 21 |
) |
| 22 |
|
| 23 |
target = executable( |
| 24 |
'main_custom_target', |
| 25 |
structured_sources( |
| 26 |
['src/main.rs', ct], |
| 27 |
), |
| 28 |
) |
| 29 |
|
| 30 |
# Should not be copied |
| 31 |
executable( |
| 32 |
'no_copy_target', |
| 33 |
structured_sources( |
| 34 |
['src2/main-unique.rs'], |
| 35 |
{'foo': 'src2/foo/mod.rs'}, |
| 36 |
), |
| 37 |
) |
| 38 |
|
| 39 |
test('no-copy', find_program('no_copy_test.py'), args : meson.current_build_dir()) |
| 40 |
|
| 41 |
subdir('src2') |
| 42 |
|
| 43 |
executable('copy-no-gen', srcs2) |
| 44 |
executable('copy-no-gen-with-non-rs', srcs2_empty) |
| 45 |
|
| 46 |
m_src = configure_file( |
| 47 |
input : 'main-gen-copy.rs', |
| 48 |
output : 'main-gen-copy.rs', |
| 49 |
configuration : {'dir' : meson.current_build_dir().replace('\\', '/')}, |
| 50 |
) |
| 51 |
|
| 52 |
m_src2 = configure_file( |
| 53 |
input : 'priv.rs', |
| 54 |
output : 'include.rs', |
| 55 |
copy : true |
| 56 |
) |
| 57 |
|
| 58 |
executable('gen-no-copy', structured_sources([m_src, m_src2])) |
| 59 |
|
| 60 |
executable('gen-no-copy-with-non-rust', structured_sources(['empty.file', m_src, m_src2])) |