meson stuff

This commit is contained in:
psykose 2024-10-29 19:13:49 +01:00
parent 2f70f61547
commit 2bba51b97b
2 changed files with 12 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
target/

View file

@ -43,8 +43,15 @@ subdir('po')
subdir('resources') subdir('resources')
subdir('src') subdir('src')
if get_option('buildtype') == 'debug'
rust_args = []
rust_target = 'debug'
else
rust_args = ['--release']
rust_target = 'release'
endif
cargo = find_program('cargo') cargo = find_program('cargo')
# TODO: cargo release build
custom_target( custom_target(
'cargo-build', 'cargo-build',
build_by_default: true, build_by_default: true,
@ -53,19 +60,20 @@ custom_target(
audrey_c, audrey_c,
blueprints, blueprints,
], ],
console: true,
output: meson.project_name(), output: meson.project_name(),
command: [ command: [
'env', 'env',
'CARGO_HOME=' + meson.project_build_root() / 'cargo-home',
'RUSTFLAGS=-L ' + fs.parent(audrey_c.full_path()), 'RUSTFLAGS=-L ' + fs.parent(audrey_c.full_path()),
'MESON_BUILD_ROOT=' + meson.project_build_root(), 'MESON_BUILD_ROOT=' + meson.project_build_root(),
cargo, cargo,
'build', 'build',
rust_args,
'--manifest-path', meson.project_source_root() / 'Cargo.toml', '--manifest-path', meson.project_source_root() / 'Cargo.toml',
'--target-dir', meson.project_build_root() / 'cargo-target', '--target-dir', meson.project_build_root() / 'cargo-target',
'&&', '&&',
'cp', 'cp',
'cargo-target' / 'debug' / meson.project_name(), 'cargo-target' / rust_target / meson.project_name(),
'@OUTPUT@', '@OUTPUT@',
], ],
) )