Debian Codegraph @

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

raw
1 project('transitive dependencies', 'rust', 'c',
2 version : '1.0.0',
3 meson_version : '>= 1.0.0',
4 default_options : ['rust_std=2018'],
5 )
6
7 subdir('liba')
8 subdir('libb')
9
10 main = executable('main', 'main.rs',
11 dependencies : [libb_dep],
12 )
13
14 # Since foo-rs is a static library, its dependencies are normally added to
15 # footest link command. However, since pm is a proc-macro, footest should not
16 # link with it. In native build this is an harmless overlinking, but in cross
17 # building foo and pm are for different arch and it would fail to link.
18 rust = import('rust')
19 pm = rust.proc_macro('pm', 'proc.rs')
20 foo = static_library('foo-rs', 'foo.rs',
21 rust_abi: 'c',
22 link_with: pm,
23 )
24 shared_library('shared', 'foo.c', link_with : foo)
25 exe = executable('footest', 'foo.c',
26 link_with: foo,
27 )
28 test('footest', exe)
29
30 subdir('diamond')
31
32 # The ninja rule for libstatic2.a does not depend on libstatic1.a because it
33 # only need static2.c.o to create the archive. That means that the ninja rule
34 # for app must depend on both, otherwise libstatic1.a won't be built and linking
35 # will fail.
36 static1 = static_library('static1', 'static1.c', build_by_default: false)
37 static2 = static_library('static2', 'static2.c', link_with: static1)
38 exe = executable('app', 'app.rs', link_with: static2)