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

Unified Diff: build/compiler_version.py

Issue 10837005: Also detect the CXX_target enviroment vairiable for compiler version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync again Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/compiler_version.py
diff --git a/build/compiler_version.py b/build/compiler_version.py
index b349199992caeefc5c63b227083a98a5400fda3f..eae7b176dd2187be3aa52d236f030aebc4d3e02f 100755
--- a/build/compiler_version.py
+++ b/build/compiler_version.py
@@ -33,21 +33,42 @@ def GetVersion(compiler):
print >> sys.stderr, e
return ""
-def main():
- # Check if CXX environment variable exists and
- # if it does use that compiler.
- cxx = os.getenv("CXX", None)
+def GetVersionFromEnvironment(compiler_env):
+ """ Returns the version of compiler
+
+ If the compiler was set by the given environment variable and exists,
+ return its version, otherwise None is returned.
+ """
+ cxx = os.getenv(compiler_env, None)
if cxx:
- cxxversion = GetVersion(cxx)
- if cxxversion != "":
- print cxxversion
- return 0
- else:
- # Otherwise we check the g++ version.
- gccversion = GetVersion("g++")
- if gccversion != "":
- print gccversion
- return 0
+ cxx_version = GetVersion(cxx)
+ if cxx_version != "":
+ return cxx_version
+ return None
+
+def main():
+ # Check if CXX_target or CXX environment variable exists an if it does use
+ # that compiler.
+ # TODO: Fix ninja (see http://crbug.com/140900) instead and remove this code
+ # In ninja's cross compile mode, the CXX_target is target compiler, while
+ # the CXX is host. The CXX_target needs be checked first, though the target
+ # and host compiler have different version, there seems no issue to use the
+ # target compiler's version number as gcc_version in Android.
+ cxx_version = GetVersionFromEnvironment("CXX_target")
+ if cxx_version:
+ print cxx_version
+ return 0
+
+ cxx_version = GetVersionFromEnvironment("CXX")
+ if cxx_version:
+ print cxx_version
+ return 0
+
+ # Otherwise we check the g++ version.
+ gccversion = GetVersion("g++")
+ if gccversion != "":
+ print gccversion
+ return 0
return 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698