Debian Codegraph @

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