diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2010-09-16 17:17:54 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2010-09-16 17:17:54 (GMT) |
commit | edc54cfdb44b7c1f95d2dc0c4a014cece789b29e (patch) | |
tree | e98e2222811d5221b59fe1adf0d26e4cf90dac2d /src | |
parent | 01eaeb7e63698df85c03b6aa75bbcfd999742860 (diff) | |
download | SCons-edc54cfdb44b7c1f95d2dc0c4a014cece789b29e.zip SCons-edc54cfdb44b7c1f95d2dc0c4a014cece789b29e.tar.gz SCons-edc54cfdb44b7c1f95d2dc0c4a014cece789b29e.tar.bz2 |
Linux part of issue #2669: support for Intel C compiler v11
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Tool/intelc.py | 78 |
1 files changed, 57 insertions, 21 deletions
diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index 5629636..dea5b92 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -230,14 +230,19 @@ def get_all_compiler_versions(): for d in glob.glob('/opt/intel/cc*/*'): # Typical dir here is /opt/intel/cc/9.0 for IA32, # /opt/intel/cce/9.0 for EMT64 (AMD64) - m = re.search(r'([0-9.]+)$', d) + m = re.search(r'([0-9][0-9.]*)$', d) + if m: + versions.append(m.group(1)) + for d in glob.glob('/opt/intel/Compiler/*'): + # Typical dir here is /opt/intel/Compiler/11.1 + m = re.search(r'([0-9][0-9.]*)$', d) if m: versions.append(m.group(1)) elif is_mac: for d in glob.glob('/opt/intel/cc*/*'): # Typical dir here is /opt/intel/cc/9.0 for IA32, # /opt/intel/cce/9.0 for EMT64 (AMD64) - m = re.search(r'([0-9.]+)$', d) + m = re.search(r'([0-9][0-9.]*)$', d) if m: versions.append(m.group(1)) return sorted(uniquify(versions)) # remove dups @@ -259,15 +264,33 @@ def get_intel_compiler_top(version, abi): and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")): raise MissingDirError("Can't find Intel compiler in %s"%(top)) elif is_mac or is_linux: - # first dir is new (>=9.0) style, second is old (8.0) style. - dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s') - if abi == 'x86_64': - dirs=('/opt/intel/cce/%s',) # 'e' stands for 'em64t', aka x86_64 aka amd64 - top=None - for d in dirs: - if os.path.exists(os.path.join(d%version, "bin", "icc")): - top = d%version - break + def find_in_2008style_dir(version): + # first dir is new (>=9.0) style, second is old (8.0) style. + dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s') + if abi == 'x86_64': + dirs=('/opt/intel/cce/%s',) # 'e' stands for 'em64t', aka x86_64 aka amd64 + top=None + for d in dirs: + if os.path.exists(os.path.join(d%version, "bin", "icc")): + top = d%version + break + return top + def find_in_2010style_dir(version): + dirs=('/opt/intel/Compiler/%s/*'%version) + # typically /opt/intel/Compiler/11.1/064 (then bin/intel64/icc) + dirs=glob.glob(dirs) + # find highest sub-version number by reverse sorting and picking first existing one. + dirs.sort() + dirs.reverse() + top=None + for d in dirs: + if (os.path.exists(os.path.join(d, "bin", "ia32", "icc")) or + os.path.exists(os.path.join(d, "bin", "intel64", "icc"))): + top = d + break + return top + top = find_in_2010style_dir(version) or find_in_2008style_dir(version) + print "INTELC: top=",top if not top: raise MissingDirError("Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi)) return top @@ -353,29 +376,42 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): (str(version), str(abi))) if topdir: + archdir={'x86_64': 'intel64', + 'amd64' : 'intel64', + 'em64t' : 'intel64', + 'x86' : 'ia32', + 'i386' : 'ia32', + 'ia32' : 'ia32' + }[abi] # for v11 and greater + if os.path.exists(os.path.join(topdir, 'bin', archdir)): + bindir="bin/%s"%archdir + libdir="lib/%s"%archdir + else: + bindir="bin" + libdir="lib" if verbose: - print "Intel C compiler: using version %s (%g), abi %s, in '%s'"%\ - (repr(version), linux_ver_normalize(version),abi,topdir) + print "Intel C compiler: using version %s (%g), abi %s, in '%s/%s'"%\ + (repr(version), linux_ver_normalize(version),abi,topdir,bindir) if is_linux: # Show the actual compiler version by running the compiler. - os.system('%s/bin/icc --version'%topdir) + os.system('%s/%s/icc --version'%(topdir,bindir)) if is_mac: # Show the actual compiler version by running the compiler. - os.system('%s/bin/icc --version'%topdir) + os.system('%s/%s/icc --version'%(topdir,bindir)) env['INTEL_C_COMPILER_TOP'] = topdir if is_linux: paths={'INCLUDE' : 'include', - 'LIB' : 'lib', - 'PATH' : 'bin', - 'LD_LIBRARY_PATH' : 'lib'} + 'LIB' : libdir, + 'PATH' : bindir, + 'LD_LIBRARY_PATH' : libdir} for p in paths.keys(): env.PrependENVPath(p, os.path.join(topdir, paths[p])) if is_mac: paths={'INCLUDE' : 'include', - 'LIB' : 'lib', - 'PATH' : 'bin', - 'LD_LIBRARY_PATH' : 'lib'} + 'LIB' : libdir, + 'PATH' : bindir, + 'LD_LIBRARY_PATH' : libdir} for p in paths.keys(): env.PrependENVPath(p, os.path.join(topdir, paths[p])) if is_windows: |