summaryrefslogtreecommitdiffstats
path: root/build/gyp_chromium
diff options
context:
space:
mode:
Diffstat (limited to 'build/gyp_chromium')
-rwxr-xr-xbuild/gyp_chromium26
1 files changed, 25 insertions, 1 deletions
diff --git a/build/gyp_chromium b/build/gyp_chromium
index 8e841d4..fd162ea 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.
@@ -226,6 +243,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()
@@ -286,7 +307,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
@@ -401,6 +423,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()