Debian Codegraph @

vendored-meson/meson/test cases/rust/21 transitive dependencies/diamond/meson.build

raw
1 # Regression test for a diamond dependency graph:
2 # ┌►R1┐
3 # main-►R3─┤ ├─►C1
4 # └►R2┘
5 # Both libr1.rlib and libr2.rlib used to contain func.c.o. That was causing
6 # libr3.rlib to have duplicated func.c.o and then libmain.so failed to link:
7 # multiple definition of `c_func'.
8
9 libc1 = static_library('c1', 'func.c')
10 libr1 = static_library('r1', 'r1.rs', link_with: libc1)
11 libr2 = static_library('r2', 'r2.rs', link_with: libc1)
12 libr3 = static_library('r3', 'r3.rs',
13 link_with: [libr1, libr2],
14 rust_abi: 'c',
15 )
16 shared_library('main', 'main.c', link_whole: [libr3])
17
18 # Same dependency graph, but r3 is now installed. Since c1, r1 and r2 are
19 # not installed, r3 must contain them.
20 libr3 = static_library('r3-installed', 'r3.rs',
21 link_with: [libr1, libr2],
22 rust_abi: 'c',
23 install: true,
24 )
25 shared_library('main-installed', 'main.c', link_with: [libr3])