Skip to content

Commit

Permalink
Force strip = false for the current profile
Browse files Browse the repository at this point in the history
Fixes #87.
  • Loading branch information
intelfx committed May 8, 2024
1 parent b8973c3 commit 6ce66f6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,16 +681,23 @@ fn process_crate(args: &Args) -> Result<CrateData, Error> {
Err(Error::UnsupportedCrateType)
}

fn get_cargo_envs(args: &Args, target_triple: &str)
-> Vec<(impl AsRef<OsStr>, impl AsRef<OsStr>)> {
fn get_cargo_envs(
args: &Args,
target_triple: &str
) -> Vec<(impl AsRef<OsStr>, impl AsRef<OsStr>)> {
let mut list = Vec::new();

let profile = args.get_profile()
.to_ascii_uppercase()
.replace('-', "_");

// When targeting MSVC, symbols data will be stored in PDB files,
// so always generate debug info
// No matter which profile we are building for, never strip the binary
// because we need the symbols.
list.push((format!("CARGO_PROFILE_{}_STRIP", profile), "false"));

// When targeting MSVC, symbols data will be stored in PDB files.
// Because of that, the Release build would not have any useful information
// even if not stripped. Therefore, force the debug info for MSVC target.
if target_triple.contains("msvc") {
list.push((format!("CARGO_PROFILE_{}_DEBUG", profile), "true"));
}
Expand Down

0 comments on commit 6ce66f6

Please sign in to comment.