| 1 |
project('linkcustom', 'c') |
| 2 |
|
| 3 |
# This would require passing the static linker to the build script or having |
| 4 |
# it detect it by itself. I'm too lazy to implement it now and it is not |
| 5 |
# really needed for testing that custom targets work. It is the responsibility |
| 6 |
# of the custom target to produce things in the correct format. |
| 7 |
assert(not meson.is_cross_build(), |
| 8 |
'MESON_SKIP_TEST cross checking not implemented.') |
| 9 |
|
| 10 |
cc = meson.get_compiler('c') |
| 11 |
genprog = find_program('generate_stlibs.py') |
| 12 |
|
| 13 |
clib = custom_target('linkcustom', |
| 14 |
output: ['libflob_1.a', 'libflob_2.a'], |
| 15 |
command: [genprog, |
| 16 |
'-o', '@OUTPUT@', |
| 17 |
'--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) |
| 18 |
|
| 19 |
clibs = [clib[0], clib[1]] |
| 20 |
|
| 21 |
exe = executable('prog', 'prog.c', link_with: clibs) |
| 22 |
test('linkcustom', exe) |
| 23 |
|
| 24 |
d = declare_dependency(link_with: clibs) |
| 25 |
|
| 26 |
exe2 = executable('prog2', 'prog.c', dependencies: d) |
| 27 |
test('linkcustom2', exe2) |
| 28 |
|
| 29 |
# Link whole tests |
| 30 |
|
| 31 |
if meson.backend() == 'xcode' |
| 32 |
message('Xcode does not support link whole so skipping.') |
| 33 |
subdir_done() |
| 34 |
endif |
| 35 |
|
| 36 |
exe3 = executable('prog3', 'prog.c', link_whole: clibs) |
| 37 |
test('linkwhole', exe) |
| 38 |
|
| 39 |
d2 = declare_dependency(link_whole: clibs) |
| 40 |
|
| 41 |
exe4 = executable('prog4', 'prog.c', dependencies: d2) |
| 42 |
test('linkwhole2', exe2) |