diff options
author | Ole André Vadla RavnÄs <oleavr@gmail.com> | 2018-08-18 23:07:07 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-08-22 22:58:13 +0300 |
commit | 6cd71a8033f54fe12e7f2d48fb660fee29e7efb9 (patch) | |
tree | d29016fb07388401f98638e75a4e853c4c1bfe7f /mesonbuild/compilers/c.py | |
parent | 5e93393cd912f08dd6b561b78f50a83fef430097 (diff) | |
download | meson-6cd71a8033f54fe12e7f2d48fb660fee29e7efb9.zip meson-6cd71a8033f54fe12e7f2d48fb660fee29e7efb9.tar.gz meson-6cd71a8033f54fe12e7f2d48fb660fee29e7efb9.tar.bz2 |
compilers: Reduce sizes of MSVC linked binaries
- For optimization=s add /O1: Use Maximum Optimization (Favor Size),
and remove /Os as it's implied by /O1.
- Because we add /O1, this implies /Gy, i.e. Function-Level Linking, so
unused code can be omitted.
- Add /Gw: Optimize Global Data, so unused data can be omitted.
With buildtype=minsize on x86 this reduces the size of a statically
linked Vala compiler binary from 5 MB down to just 1.87 MB.
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 3599a99..436f699 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1247,7 +1247,10 @@ class VisualStudioCCompiler(CCompiler): return ['/MDd'] def get_buildtype_args(self, buildtype): - return compilers.msvc_buildtype_args[buildtype] + args = compilers.msvc_buildtype_args[buildtype] + if version_compare(self.version, '<18.0'): + args = [arg for arg in args if arg != '/Gw'] + return args def get_buildtype_linker_args(self, buildtype): return compilers.msvc_buildtype_linker_args[buildtype] |