diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-12 13:27:01 +0200 |
|---|---|---|
| committer | Xavier Claessens <xclaesse@gmail.com> | 2025-10-27 21:14:30 +0100 |
| commit | f08a8f94e7c9ed3d4d8cb08c1a23153b6f122819 (patch) | |
| tree | 82e50a9c69943a2a81b39ca2d6547af673b7cc73 /test cases | |
| parent | 271dbd81c3821c7535056470b52ddbd6f5ada703 (diff) | |
| download | meson-f08a8f94e7c9ed3d4d8cb08c1a23153b6f122819.tar.gz | |
rust: drop +SUFFIX from crate name
Allow multiple targets for the same crate name, which is useful when the
same crate is used for both the host and the build machine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'test cases')
| -rw-r--r-- | test cases/rust/30 both machines/lib.rs | 3 | ||||
| -rw-r--r-- | test cases/rust/30 both machines/meson.build | 36 | ||||
| -rw-r--r-- | test cases/rust/30 both machines/test.rs | 5 |
3 files changed, 44 insertions, 0 deletions
diff --git a/test cases/rust/30 both machines/lib.rs b/test cases/rust/30 both machines/lib.rs new file mode 100644 index 000000000..432593368 --- /dev/null +++ b/test cases/rust/30 both machines/lib.rs @@ -0,0 +1,3 @@ +pub fn answer() -> u32 { + 42 +} diff --git a/test cases/rust/30 both machines/meson.build b/test cases/rust/30 both machines/meson.build new file mode 100644 index 000000000..511518a7b --- /dev/null +++ b/test cases/rust/30 both machines/meson.build @@ -0,0 +1,36 @@ +project( + 'testproj', + 'rust', + version : '0.1', + meson_version : '>= 1.9.0', + default_options : ['rust_std=2021'], +) + +lib_host = static_library( + 'lib', + 'lib.rs', + rust_abi: 'rust' +) + +lib_build = static_library( + 'lib+build', + 'lib.rs', + rust_abi: 'rust', + native: true, +) + +exe_host = executable( + 'test-host', + 'test.rs', + link_with: lib_host, +) + +exe_build = executable( + 'test-build', + 'test.rs', + link_with: lib_build, + native: true, +) + +test('host', exe_host) +test('build', exe_build) diff --git a/test cases/rust/30 both machines/test.rs b/test cases/rust/30 both machines/test.rs new file mode 100644 index 000000000..c9679d452 --- /dev/null +++ b/test cases/rust/30 both machines/test.rs @@ -0,0 +1,5 @@ +use lib::answer; + +fn main() { + println!("The answer is {}.\n", answer()); +} |
