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