Index: build/gyp_chromium |
diff --git a/build/gyp_chromium b/build/gyp_chromium |
index f8fa93664642b73b23e673a31e8225c235e0dc1d..4998aaa062014f28fef49eae98f13ee2d027c203 100755 |
--- a/build/gyp_chromium |
+++ b/build/gyp_chromium |
@@ -127,6 +127,23 @@ def GetGypVarsForGN(supplemental_files): |
return dict(supp_items + env_items + cmdline_items) |
+def GetOutputDirectory(): |
+ """Returns the output directory that GYP will use.""" |
+ # GYP generator flags from the command line. We can't use optparse since we |
+ # want to ignore all arguments other than "-G". |
+ needle = '-Goutput_dir=' |
+ cmdline_input_items = [] |
+ for item in sys.argv[1:]: |
+ if item.startswith(needle): |
+ return item[len(needle):] |
+ |
+ env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) |
+ needle = 'output_dir=' |
+ for item in env_items: |
+ if item.startswith(needle): |
+ return item[len(needle):] |
+ |
+ return "out" |
def GetArgsStringForGN(supplemental_files): |
"""Returns the args to pass to GN. |
@@ -224,6 +241,10 @@ def GetArgsStringForGN(supplemental_files): |
# Set the GYP flag so BUILD files know they're being invoked in GYP mode. |
gn_args += ' is_gyp=true' |
+ |
+ gyp_outdir = GetOutputDirectory() |
+ gn_args += ' gyp_output_dir=\"%s\"' % gyp_outdir |
+ |
return gn_args.strip() |
@@ -284,7 +305,8 @@ def RunGN(supplemental_includes): |
# to know they're being run under GYP. |
args = [gnpath, 'gyp', '-q', |
'--root=' + chrome_src, |
- '--args=' + GetArgsStringForGN(supplemental_includes)] |
+ '--args=' + GetArgsStringForGN(supplemental_includes), |
+ '--output=//' + GetOutputDirectory() + '/gn_build/'] |
return subprocess.call(args) == 0 |
@@ -397,6 +419,8 @@ if __name__ == '__main__': |
args.extend( |
['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
+ args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
+ |
print 'Updating projects from gyp files...' |
sys.stdout.flush() |