From 1c9612bd55cd8986f8f7435bd7e28faa94f53cdc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Oct 2017 21:18:21 +0530 Subject: [PATCH] Turn on LTO for release builds --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index a209608bb..65a022974 100755 --- a/setup.py +++ b/setup.py @@ -129,6 +129,8 @@ def init_env(debug=False, sanitize=False, native_optimizations=True, profile=Fal ldflags = shlex.split(ldflags) cflags += shlex.split(os.environ.get('CFLAGS', '')) ldflags += shlex.split(os.environ.get('LDFLAGS', '')) + if not debug: + cflags.append('-flto'), ldflags.append('-flto') if profile: cflags.append('-DWITH_PROFILER')