| 1 |
project('static rust and c polyglot executable', 'c', 'rust') |
| 2 |
|
| 3 |
r = static_library('stuff', 'stuff.rs', rust_crate_type : 'staticlib') |
| 4 |
|
| 5 |
# clib is installed static library and stuff is not installed. That means that |
| 6 |
# to be usable clib must link_whole stuff. Meson automatically promote to link_whole, |
| 7 |
# as it would do with C libraries, but then cannot extract objects from stuff and |
| 8 |
# thus should error out. |
| 9 |
# FIXME: We should support this use-case in the future. |
| 10 |
testcase expect_error('Cannot link_whole a custom or Rust target \'stuff\' into a static library \'clib\'. Instead, pass individual object files with the "objects:" keyword argument if possible. Meson had to promote link to link_whole because \'clib\' is installed but not \'stuff\', and thus has to include objects from \'stuff\' to be usable.') |
| 11 |
l = static_library('clib', 'clib.c', link_with : r, install : true) |
| 12 |
endtestcase |
| 13 |
|
| 14 |
l = static_library('clib', 'clib.c', link_with : r) |
| 15 |
|
| 16 |
e = executable('prog', 'prog.c', |
| 17 |
link_with : l, |
| 18 |
install : true) |
| 19 |
test('polyglottest', e) |
| 20 |
|
| 21 |
# Create a version that has overflow-checks on, then run a test to ensure that |
| 22 |
# the overflow-checks is larger than the other version by some amount |
| 23 |
r2 = static_library('stuff2', 'stuff.rs', rust_crate_type : 'staticlib', rust_args : ['-C', 'overflow-checks=on']) |
| 24 |
l2 = static_library('clib2', 'clib.c') |
| 25 |
e2 = executable('prog2', 'prog.c', link_with : [r2, l2]) |
| 26 |
test('overflow-checks', find_program('overflow_size_checks.py'), args : [e, e2]) |