diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 73d00a9a738..8547669ef7b 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -31,6 +31,7 @@ def get_opts(): ('ios_exceptions', 'Enable exceptions', 'no'), ('ios_triple', 'Triple for ios toolchain', ''), ('ios_sim', 'Build simulator binary', 'no'), + ('use_lto', 'Use link time optimization', 'no') ] @@ -147,8 +148,11 @@ def configure(env): if (env["target"].startswith("release")): env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1']) - env.Append(CPPFLAGS=['-O2', '-flto', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations']) - env.Append(LINKFLAGS=['-O2', '-flto']) + env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations']) + env.Append(LINKFLAGS=['-O2']) + if env['use_lto'] == 'yes': + env.Append(CPPFLAGS=['-flto']) + env.Append(LINKFLAGS=['-flto']) if env["target"] == "release_debug": env.Append(CPPFLAGS=['-DDEBUG_ENABLED'])