project( 'gentoo-utils', ['rust', 'cpp'], meson_version: '>=1.9.1', default_options: {'rust_std': '2024', 'rust_nightly': 'enabled'}, ) rustfmt = find_program('rustfmt') fs = import('fs') rust = import('rust') cargo = rust.workspace() mon = dependency('mon-0.1-rs') get = dependency('get-0.1-rs') itertools = dependency('itertools-0.14-rs') thiserror = dependency('thiserror-2-rs') gentoo_utils = cargo.package().library() sources = [] subdir('src') custom_target( 'rustfmt', input: sources, output: 'rustfmt', command: [rustfmt, '--edition=2024', '--check', '@INPUT@'], build_always_stale: true, ) if get_option('tests').enabled() rust.test('unittests', gentoo_utils) subdir('tests') endif if get_option('fuzz').enabled() subdir('fuzz') endif if get_option('docs').enabled() rust.doctest( 'doctests', gentoo_utils, dependencies: [mon, get, itertools, thiserror], args: ['--nocapture'], ) endif