From 6cd71a8033f54fe12e7f2d48fb660fee29e7efb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Sat, 18 Aug 2018 23:07:07 +0200 Subject: 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. --- mesonbuild/compilers/compilers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 34397aa..d08671e 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -145,8 +145,8 @@ arm_buildtype_args = {'plain': [], msvc_buildtype_args = {'plain': [], 'debug': ["/ZI", "/Ob0", "/Od", "/RTC1"], 'debugoptimized': ["/Zi", "/Ob1"], - 'release': ["/Ob2"], - 'minsize': ["/Zi", "/Ob1"], + 'release': ["/Ob2", "/Gw"], + 'minsize': ["/Zi", "/Gw"], } apple_buildtype_linker_args = {'plain': [], @@ -267,7 +267,7 @@ msvc_optimization_args = {'0': [], '1': ['/O1'], '2': ['/O2'], '3': ['/O3'], - 's': ['/Os'], + 's': ['/O1'], # Implies /Os. } clike_debug_args = {False: [], -- cgit v1.1