Browse Source

Merge pull request #302 from neivv/msvc-opt-size

Msvc needs /O1 (which implies /Os) to generate smallest binaries
cl-test
Alex Crichton 7 years ago
committed by GitHub
parent
commit
9768a0e106
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/lib.rs

4
src/lib.rs

@ -1054,8 +1054,8 @@ impl Build {
cmd.args.push(crt_flag.into());
match &opt_level[..] {
"z" | "s" => cmd.args.push("/Os".into()),
"1" => cmd.args.push("/O1".into()),
// Msvc uses /O1 to enable all optimizations that minimize code size.
"z" | "s" | "1" => cmd.args.push("/O1".into()),
// -O3 is a valid value for gcc and clang compilers, but not msvc. Cap to /O2.
"2" | "3" => cmd.args.push("/O2".into()),
_ => {}

Loading…
Cancel
Save