xref: /qemu/subprojects/packagefiles/anyhow-1-rs/meson.build (revision 96215036f47403438c7c7869b7cd419bd7a11f82)
1project('anyhow-1-rs', 'rust',
2  meson_version: '>=1.5.0',
3  version: '1.0.98',
4  license: 'MIT OR Apache-2.0',
5  default_options: [])
6
7rustc = meson.get_compiler('rust')
8
9rust_args = ['--cap-lints', 'allow']
10rust_args += ['--cfg', 'feature="std"']
11if rustc.version().version_compare('<1.65.0')
12  error('rustc version ' + rustc.version() + ' is unsupported. Please upgrade to at least 1.65.0')
13endif
14rust_args += [ '--cfg', 'std_backtrace' ] # >= 1.65.0
15if rustc.version().version_compare('<1.81.0')
16  rust_args += [ '--cfg', 'anyhow_no_core_error' ]
17endif
18
19_anyhow_rs = static_library(
20  'anyhow',
21  files('src/lib.rs'),
22  gnu_symbol_visibility: 'hidden',
23  override_options: ['rust_std=2018', 'build.rust_std=2018'],
24  rust_abi: 'rust',
25  rust_args: rust_args,
26  dependencies: [],
27)
28
29anyhow_dep = declare_dependency(
30  link_with: _anyhow_rs,
31)
32
33meson.override_dependency('anyhow-1-rs', anyhow_dep)
34