You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
project('rust proc-macro', 'rust')
|
|
|
|
|
|
|
|
if build_machine.system() != 'linux'
|
|
|
|
error('MESON_SKIP_TEST, this test only works on Linux. Patches welcome.')
|
|
|
|
endif
|
|
|
|
|
|
|
|
pm = shared_library(
|
|
|
|
'proc_macro_examples',
|
|
|
|
'proc.rs',
|
|
|
|
rust_crate_type : 'proc-macro',
|
|
|
|
)
|
|
|
|
|
|
|
|
main = executable(
|
|
|
|
'main',
|
|
|
|
'use.rs',
|
rust: fix -C prefer-dynamic behavior
I noticed when building a project that uses a proc macro that Meson
passed -C prefer-dynamic for the executable, and not the proc macro,
while cargo passed -C prefer-dynamic for the proc macro, but not for
the executable. Meson's behavior broke setting -C panic=abort on the
executable.
As far as we can tell, because we explicitly pass each library path to
rustc, the only thing -C prefer-dynamic affects in Meson is how the
standard libraries are linked. Generally, one does not want the
standard libraries to be dynamically linked, because if the Rust
compiler is ever updated, anything linked against the old standard
libraries will likely break, due to the lack of a stable Rust ABI.
Therefore, I've reorganised Meson's behavior around the principle that
the standard libraries should only be dynamically linked when Rust
dynamic linking has already been opted into in some other way. The
details of how this manifests are now explained in the documentation.
2 years ago
|
|
|
link_with : pm,
|
|
|
|
rust_args : ['-C', 'panic=abort'],
|
|
|
|
)
|
|
|
|
|
|
|
|
test('main_test', main)
|