use env vars for cargo flags
this is more scuffed but means devenv gets a full env, so one can run all custom stuff in the `meson devenv -C build` shell which is nicer because you can pass flags to what you run (e.g. cargo doc --open) instead of needing fixed targets
This commit is contained in:
parent
0e50cf9f39
commit
f15019f49d
1 changed files with 2 additions and 7 deletions
|
@ -52,6 +52,8 @@ endif
|
||||||
cargo = find_program('cargo')
|
cargo = find_program('cargo')
|
||||||
cargo_env = environment()
|
cargo_env = environment()
|
||||||
cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root())
|
cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root())
|
||||||
|
cargo_env.set('CARGO_MANIFEST_DIR', meson.project_source_root())
|
||||||
|
cargo_env.set('CARGO_TARGET_DIR', meson.project_build_root() / 'target')
|
||||||
meson.add_devenv(cargo_env)
|
meson.add_devenv(cargo_env)
|
||||||
|
|
||||||
custom_target(
|
custom_target(
|
||||||
|
@ -67,13 +69,6 @@ custom_target(
|
||||||
cargo,
|
cargo,
|
||||||
'build',
|
'build',
|
||||||
rust_args,
|
rust_args,
|
||||||
'--manifest-path',
|
|
||||||
meson.project_source_root() / 'Cargo.toml',
|
|
||||||
'--target-dir',
|
|
||||||
meson.project_build_root() / 'cargo-target',
|
|
||||||
],
|
],
|
||||||
env: cargo_env,
|
env: cargo_env,
|
||||||
)
|
)
|
||||||
|
|
||||||
run_target('clippy', command: [cargo, 'clippy'], env: cargo_env)
|
|
||||||
run_target('cargo-doc', command: [cargo, 'doc'], env: cargo_env)
|
|
||||||
|
|
Loading…
Reference in a new issue