This repository was archived by the owner on Apr 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11//! Get config from the shader crate's `Cargo.toml` `[*.metadata.rust-gpu.*]`
22
3+ use serde_json:: Value ;
4+
35/// `Metadata` refers to the `[metadata.*]` section of `Cargo.toml` that `cargo` formally
46/// ignores so that packages can implement their own behaviour with it.
57#[ derive( Debug ) ]
@@ -59,8 +61,19 @@ impl Metadata {
5961 & mut metadata,
6062 {
6163 log:: debug!( "looking for crate metadata" ) ;
62- let crate_meta = Self :: get_crate_metadata ( cargo_json, path) ?;
64+ let mut crate_meta = Self :: get_crate_metadata ( cargo_json, path) ?;
6365 log:: trace!( "crate_metadata: {crate_meta:#?}" ) ;
66+ if let Some ( output_path) = crate_meta. pointer_mut ( "/build/output_dir" ) {
67+ log:: debug!( "found output-dir path in crate metadata: {:?}" , output_path) ;
68+ if let Some ( output_dir) = output_path. clone ( ) . as_str ( ) {
69+ let new_output_path = path. join ( output_dir) ;
70+ * output_path = Value :: String ( format ! ( "{}" , new_output_path. display( ) ) ) ;
71+ log:: debug!(
72+ "setting that to be relative to the Cargo.toml it was found in: {}" ,
73+ new_output_path. display( )
74+ ) ;
75+ }
76+ }
6477 crate_meta
6578 } ,
6679 None ,
You can’t perform that action at this time.
0 commit comments