From f15019f49d7f04a1e440242e7e0abff41520769c Mon Sep 17 00:00:00 2001 From: psykose Date: Mon, 4 Nov 2024 23:18:03 +0100 Subject: [PATCH] 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 --- meson.build | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index a99ed19..70d92fd 100644 --- a/meson.build +++ b/meson.build @@ -52,6 +52,8 @@ endif cargo = find_program('cargo') cargo_env = environment() 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) custom_target( @@ -67,13 +69,6 @@ custom_target( cargo, 'build', rust_args, - '--manifest-path', - meson.project_source_root() / 'Cargo.toml', - '--target-dir', - meson.project_build_root() / 'cargo-target', ], env: cargo_env, ) - -run_target('clippy', command: [cargo, 'clippy'], env: cargo_env) -run_target('cargo-doc', command: [cargo, 'doc'], env: cargo_env)