| 1 |
project('selfbuilt custom', 'cpp') |
| 2 |
|
| 3 |
# Build an exe and use it in a custom target |
| 4 |
# whose output is used to build a different exe. |
| 5 |
|
| 6 |
tool = executable('tool', 'tool.cpp', native : true) |
| 7 |
|
| 8 |
hfile = custom_target('datah', |
| 9 |
output : 'data.h', |
| 10 |
input : 'data.dat', |
| 11 |
command : [tool, '@INPUT@', '@OUTPUT@'], |
| 12 |
) |
| 13 |
|
| 14 |
main = executable('mainprog', 'mainprog.cpp', hfile) |
| 15 |
|
| 16 |
test('maintest', main) |
| 17 |
|
| 18 |
lib = library('libtool', 'tool.cpp') |
| 19 |
|
| 20 |
checkarg = executable('checkarg', 'checkarg.cpp', native : true) |
| 21 |
|
| 22 |
ctlib = custom_target('ctlib', |
| 23 |
output : 'ctlib.out', |
| 24 |
capture : true, |
| 25 |
command : [checkarg, lib], |
| 26 |
build_by_default : true, |
| 27 |
) |
| 28 |
|
| 29 |
if meson.is_cross_build() and meson.can_run_host_binaries() |
| 30 |
checkarg_host = executable('checkarg_host', 'checkarg.cpp') |
| 31 |
|
| 32 |
ctlib_host = custom_target( |
| 33 |
'ctlib_host', |
| 34 |
output : 'ctlib.host.out', |
| 35 |
capture : true, |
| 36 |
command : [checkarg_host, lib], |
| 37 |
build_by_default : true, |
| 38 |
) |
| 39 |
endif |