Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: pylib/gyp/msvs_emulation.py

Issue 13950005: Fully qualify path to cl.exe for ninja windows, and support *_wrapper from environment (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« pylib/gyp/generator/ninja.py ('K') | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/msvs_emulation.py
===================================================================
--- pylib/gyp/msvs_emulation.py (revision 1611)
+++ pylib/gyp/msvs_emulation.py (working copy)
@@ -724,6 +724,11 @@
block += nul
return block
+def _ExtractCLPath(output_of_where):
+ """Gets the path to cl.exe based on the output of `where`."""
+ # Take the first line, as that's the first found in the PATH.
+ return output_of_where.strip().splitlines()[0].strip()
+
def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, open_out):
"""It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
@@ -742,7 +747,9 @@
if generator_flags.get('ninja_use_custom_environment_files', 0):
return
vs = GetVSVersion(generator_flags)
+ cl_paths = {}
for arch in ('x86', 'x64'):
+ # Extract environment variables for subprocesses.
args = vs.SetupScript(arch)
args.extend(('&&', 'set'))
popen = subprocess.Popen(
@@ -754,6 +761,14 @@
f.write(env_block)
f.close()
+ # Find cl.exe location for this architecture.
+ args = vs.SetupScript(arch)
+ args.extend(('&&', 'where', 'cl.exe'))
+ popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)
+ output, _ = popen.communicate()
+ cl_paths[arch] = _ExtractCLPath(output)
+ return cl_paths
+
def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja):
"""Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
« pylib/gyp/generator/ninja.py ('K') | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698