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
|
libgit_rs_sources = [
'lib.rs',
'varint.rs',
]
# Unfortunately we must use a wrapper command to move the output file into the
# current build directory. This can fixed once `cargo build --artifact-dir`
# stabilizes. See https://github.com/rust-lang/cargo/issues/6790 for that
# effort.
cargo_command = [
shell,
meson.current_source_dir() / 'cargo-meson.sh',
meson.project_source_root(),
meson.current_build_dir(),
]
if get_option('buildtype') == 'release'
cargo_command += '--release'
endif
libgit_rs = custom_target('git_rs',
input: libgit_rs_sources + [
meson.project_source_root() / 'Cargo.toml',
],
output: 'libgitcore.a',
command: cargo_command,
)
libgit_dependencies += declare_dependency(link_with: libgit_rs)
if get_option('tests')
test('rust', cargo,
args: [
'test',
'--manifest-path',
meson.project_source_root() / 'Cargo.toml',
'--target-dir',
meson.current_build_dir() / 'target',
],
timeout: 0,
protocol: 'rust',
)
endif
|