diff options
author | Jose <jose@zeroc.com> | 2012-12-18 23:19:18 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-12-18 23:19:18 +0100 |
commit | 6d029f690f85060ea7f30a3255b49302235510df (patch) | |
tree | 3afac10639c82cf73354514660b2d4083e1e8234 /demoscript/Util.py | |
parent | Fixed (ICE-5142) - IceGridGUI manual notes to run when build without proguard (diff) | |
download | ice-6d029f690f85060ea7f30a3255b49302235510df.tar.bz2 ice-6d029f690f85060ea7f30a3255b49302235510df.tar.xz ice-6d029f690f85060ea7f30a3255b49302235510df.zip |
Demo & test script fixes for CPP_COMPILER detection
Diffstat (limited to 'demoscript/Util.py')
-rw-r--r-- | demoscript/Util.py | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/demoscript/Util.py b/demoscript/Util.py index 66f0c3bd8d3..fa266745fc0 100644 --- a/demoscript/Util.py +++ b/demoscript/Util.py @@ -14,6 +14,7 @@ import re import os import signal import time +import subprocess # Locate the top level directory of the demo dist (or the top of the # source tree for a source dist). @@ -50,6 +51,40 @@ host = "127.0.0.1" # debug = False +def getCppCompiler(): + if not isWin32(): + return "" + compiler = "" + if os.environ.get("CPP_COMPILER", "") != "": + compiler = os.environ["CPP_COMPILER"] + else: + config = None + if os.path.exists(os.path.join(toplevel, "cpp", "config", "Make.rules.mak")): + config = open(os.path.join(toplevel, "cpp", "config", "Make.rules.mak"), "r") + elif os.path.exists(os.path.join(toplevel, "config", "Make.rules.mak")): + config = open(os.path.join(toplevel, "config", "Make.rules.mak"), "r") + if config != None: + compiler = re.search("CPP_COMPILER[\t\s]*= ([A-Z0-9]*)", config.read()).group(1) + if compiler != "VC90" and compiler != "VC100" and compiler != "VC110": + compiler = "" + + if compiler == "": + p = subprocess.Popen("cl", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + if not p or not p.stdout: + print("Cannot detect C++ compiler") + sys.exit(1) + l = p.stdout.readline().decode("utf-8").strip() + if l.find("Version 15") != -1: + compiler = "VC90" + elif l.find("Version 16") != -1: + compiler = "VC100" + elif l.find("Version 17") != -1: + compiler = "VC110" + else: + print("Cannot detect C++ compiler") + sys.exit(1) + return compiler + origenv = {} def dumpenv(): print("the following environment variables have been set:") @@ -106,11 +141,10 @@ def configurePaths(): addenv("PATH", binDir) if iceHome: if isWin32(): - compilers = { - "VC110" : "vc110", - "VC110_EXPRESS" : "vc110" - } - subdir = compilers.get(os.environ.get("CPP_COMPILER", None), "") + subdir = None + if getCppCompiler() == "VC110": + subdir = "vc110" + if subdir: if x64: addenv("PATH", os.path.join(binDir, subdir, "x64")) @@ -256,18 +290,7 @@ def isSolaris(): def isNoServices(): if not isWin32(): return False - compiler = "" - if os.environ.get("CPP_COMPILER", "") != "": - compiler = os.environ["CPP_COMPILER"] - else: - config = None - if os.path.exists(os.path.join(toplevel, "cpp", "config", "Make.rules.mak")): - config = open(os.path.join(toplevel, "cpp", "config", "Make.rules.mak"), "r") - elif os.path.exists(os.path.join(toplevel, "config", "Make.rules.mak")): - config = open(os.path.join(toplevel, "config", "Make.rules.mak"), "r") - if config != None: - compiler = re.search("CPP_COMPILER[\t\s]*= ([A-Z0-9]*)", config.read()).group(1) - return compiler == "VC60" + return getCppCompiler() == "VC90" def getMapping(): """Determine the current mapping based on the cwd.""" |