Skip to content

Commit

Permalink
Allow disabling LTO in optimized builds. (flutter#4057)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Sep 5, 2017
1 parent 1c99b3f commit be634bc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ def to_gn_args(args):
gn_args['android_full_debug'] = args.target_os == 'android' and args.unoptimized
gn_args['is_clang'] = not sys.platform.startswith(('cygwin', 'win'))

enable_lto = args.lto
if args.unoptimized:
# There is no point in enabling LTO in unoptimized builds.
enable_lto = False

if args.target_os != 'win':
gn_args['enable_lto'] = not args.unoptimized
# The GN arg is not available in the windows toolchain.
gn_args['enable_lto'] = enable_lto

aot = args.runtime_mode != 'debug'
if args.target_os == 'android':
Expand Down Expand Up @@ -187,6 +193,9 @@ def parse_args(args):
parser.add_argument('--goma', default=True, action='store_true')
parser.add_argument('--no-goma', dest='goma', action='store_false')

parser.add_argument('--lto', default=True, action='store_true')
parser.add_argument('--no-lto', dest='lto', action='store_false')

parser.add_argument('--clang', default=True, action='store_true')
parser.add_argument('--no-clang', dest='clang', action='store_false')

Expand Down

0 comments on commit be634bc

Please sign in to comment.