1project('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. 7assert(not meson.is_cross_build(), 8 'MESON_SKIP_TEST cross checking not implemented.') 9 10cc = meson.get_compiler('c') 11genprog = find_program('generate_conflicting_stlibs.py') 12 13clib = 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 19clib_2 = clib[1] 20 21exe = executable('prog', 'prog.c', link_with: clib_2) 22test('linkcustom', exe) 23 24d = declare_dependency(link_with: clib_2) 25 26exe2 = executable('prog2', 'prog.c', dependencies: d) 27test('linkcustom2', exe2) 28 29# Link whole tests 30 31if meson.backend() == 'xcode' 32 message('Xcode does not support link whole so skipping.') 33 subdir_done() 34endif 35 36exe3 = executable('prog3', 'prog.c', link_whole: clib_2) 37test('linkwhole', exe) 38 39d2 = declare_dependency(link_whole: clib_2) 40 41exe4 = executable('prog4', 'prog.c', dependencies: d2) 42test('linkwhole2', exe2) 43