| 1 |
# Try using sourceset with various kinds of generated sources |
| 2 |
|
| 3 |
project('a', 'c') |
| 4 |
|
| 5 |
cp = find_program('cp.py') |
| 6 |
|
| 7 |
source_set = import('sourceset') |
| 8 |
sources = source_set.source_set() |
| 9 |
|
| 10 |
a_c = custom_target('gen-custom-target', |
| 11 |
input: 'a.c', output: 'out_a.c', |
| 12 |
command: [cp, '@INPUT@', '@OUTPUT@']) |
| 13 |
sources.add(when: 'YES', if_true: a_c) |
| 14 |
sources.add(when: 'YES', if_true: a_c[0]) |
| 15 |
|
| 16 |
f_c = configure_file(input: 'f.c', output: 'out_f.c', copy: true) |
| 17 |
sources.add(when: 'YES', if_true: f_c) |
| 18 |
sources.add(when: 'YES', if_true: f_c) |
| 19 |
|
| 20 |
gen = generator(cp, output: 'out_@PLAINNAME@', arguments: ['@INPUT@', '@OUTPUT@']) |
| 21 |
g_c = gen.process(files('g.c')) |
| 22 |
sources.add(when: 'YES', if_true: g_c) |
| 23 |
sources.add(when: 'YES', if_true: g_c) |
| 24 |
|
| 25 |
conf1 = { 'YES': true, } |
| 26 |
result1 = sources.apply(conf1) |
| 27 |
|
| 28 |
executable('first', sources: result1.sources(), dependencies: result1.dependencies()) |