| 1 |
project('rust shared library', 'rust', 'c') |
| 2 |
|
| 3 |
rustc = meson.get_compiler('rust') |
| 4 |
|
| 5 |
subdir('cdylib') |
| 6 |
|
| 7 |
s = static_library('static', 'value.c') |
| 8 |
|
| 9 |
# Test link_depends with a custom_target for Rust shared library. |
| 10 |
# rustc provides a version script of its own; GNU ld does not |
| 11 |
# support multiple version scripts, lld does |
| 12 |
if host_machine.system() == 'linux' and rustc.has_link_argument('-fuse-ld=lld') |
| 13 |
ct_map = import('fs').copyfile('stuff.map', 'stuff-ct.map') |
| 14 |
vflag = ['-fuse-ld=lld', '-Wl,--version-script,' + ct_map.full_path()] |
| 15 |
rustl = shared_library('stuff', 'stuff.rs', link_whole : s, install : true, |
| 16 |
link_args : vflag, link_depends : ct_map) |
| 17 |
else |
| 18 |
rustl = shared_library('stuff', 'stuff.rs', link_whole : s, install : true) |
| 19 |
endif |
| 20 |
e = executable('prog', 'prog.rs', link_with : [rustl, cl], install : true) |
| 21 |
|
| 22 |
if build_machine.system() == 'windows' |
| 23 |
rustup = find_program('rustup') |
| 24 |
test('linktest', rustup, |
| 25 |
args: ['run', 'stable', e]) |
| 26 |
else |
| 27 |
test('linktest', e) |
| 28 |
endif |