Git fork
1libgit_rs_sources = [
2 'lib.rs',
3 'varint.rs',
4]
5
6# Unfortunately we must use a wrapper command to move the output file into the
7# current build directory. This can fixed once `cargo build --artifact-dir`
8# stabilizes. See https://github.com/rust-lang/cargo/issues/6790 for that
9# effort.
10cargo_command = [
11 shell,
12 meson.current_source_dir() / 'cargo-meson.sh',
13 meson.project_source_root(),
14 meson.current_build_dir(),
15]
16if get_option('buildtype') == 'release'
17 cargo_command += '--release'
18endif
19
20libgit_rs = custom_target('git_rs',
21 input: libgit_rs_sources + [
22 meson.project_source_root() / 'Cargo.toml',
23 ],
24 output: 'libgitcore.a',
25 command: cargo_command,
26)
27libgit_dependencies += declare_dependency(link_with: libgit_rs)
28
29if get_option('tests')
30 test('rust', cargo,
31 args: [
32 'test',
33 '--manifest-path',
34 meson.project_source_root() / 'Cargo.toml',
35 '--target-dir',
36 meson.current_build_dir() / 'target',
37 ],
38 timeout: 0,
39 protocol: 'rust',
40 )
41endif