summaryrefslogtreecommitdiff
path: root/meson.build
blob: 1c4f4511d6659907b0afe2e94de669e95a7fcefe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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