Skip to content

Commit

Permalink
feat: Support for exelinkflags
Browse files Browse the repository at this point in the history
  • Loading branch information
allenli873 committed Nov 28, 2024
1 parent 16bab95 commit a0537d7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ impl CargoInstructions {
writeln!(self.out, "cargo:rerun-if-env-changed={val}").unwrap();
}

/// Adds `cargo:rustc-link-args-bins={val}` instruction.
fn rustc_link_arg_bins(&mut self, val: &str) {
writeln!(self.out, "cargo:rustc-link-arg-bins={val}").unwrap();
}

/// Adds `cargo:rustc-link-lib={lib}` instruction.
fn rustc_link_lib(&mut self, lib: &str) {
writeln!(self.out, "cargo:rustc-link-lib={lib}").unwrap();
Expand Down Expand Up @@ -608,7 +613,16 @@ impl ConanDependencyGraph {
}
};

// 5. Recursively visit dependency component requirements.
// 5. Emit "cargo:rustc-link-arg-bins=FLAGS" metadata for `rustc`.
if let Some(Value::Array(flags)) = component.get("exelinkflags") {
for flag in flags {
if let Value::String(flag) = flag {
cargo.rustc_link_arg_bins(flag);
}
}
}

// 6. Recursively visit dependency component requirements.
if let Some(Value::Array(requires)) = component.get("requires") {
for requirement in requires {
if let Value::String(req_comp_name) = requirement {
Expand Down

0 comments on commit a0537d7

Please sign in to comment.