Add support for the Intel C Compiler. (Gary Oberbrunner)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 16 Jun 2003 04:21:51 +0000 (04:21 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 16 Jun 2003 04:21:51 +0000 (04:21 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@714 fdb21ef1-2011-0410-befe-b5e4ea1792b1

bin/files
doc/man/scons.1
src/CHANGES.txt
src/engine/MANIFEST.in
src/engine/SCons/Tool/__init__.py
src/engine/SCons/Tool/icl.py [new file with mode: 0644]
test/import.py

index 1b42f74cb47f382cdd5e46ab8394e1f834e23bfb..c4b19a385f406b91893a432aa36ad8ffbcb9c671 100644 (file)
--- a/bin/files
+++ b/bin/files
@@ -49,6 +49,7 @@
 ./SCons/Tool/hpcc.py
 ./SCons/Tool/hplink.py
 ./SCons/Tool/icc.py
+./SCons/Tool/icl.py
 ./SCons/Tool/ifl.py
 ./SCons/Tool/ilink.py
 ./SCons/Tool/jar.py
index 2dd18b63a2ff5d47c0311b6e298dd6b36d77aaa8..214401f7edd519f2d4fabaae84a84834c0ad5e4e 100644 (file)
@@ -870,6 +870,7 @@ g++
 g77
 gs
 icc
+icl
 ifl
 ilink
 gas
@@ -894,10 +895,11 @@ pdflatex
 pdftex
 rmic
 sgiar
-sgias
 sgicc
-sgif77
 sgilink
+sunar
+suncc
+sunlink
 tar
 tex
 yacc
index 9b326d366cbb5d0042c95305c0127dc32826d6c1..6cb5ed8d52999697c3d72afdf08710a8199e52ab 100644 (file)
@@ -51,6 +51,10 @@ RELEASE 0.15 - XXX
 
   - Don't update the .sconsign files when run with -n.
 
+  From Gary Oberbrunner:
+
+  - Add support for the Intel C Compiler (icl.exe).
+
   From Anthony Roach
 
   - Fix Import('*').
index 870d43014543de05d06956fda35145ef924755e5..53c8c8a3a83fc9a102adaada603089255f133d0f 100644 (file)
@@ -64,6 +64,7 @@ SCons/Tool/javac.py
 SCons/Tool/JavaCommon.py
 SCons/Tool/javah.py
 SCons/Tool/icc.py
+SCons/Tool/icl.py
 SCons/Tool/ifl.py
 SCons/Tool/ilink.py
 SCons/Tool/latex.py
index ca730be811eb21989f1ba0b5e38468c6395bd353..486637f81077db3d38c82928ca38fbe921891923 100644 (file)
@@ -152,8 +152,8 @@ def tool_list(platform, env):
     # change these search orders, update the man page as well.
     if str(platform) == 'win32':
         "prefer Microsoft tools on Windows"
-        linkers = ['mslink', 'gnulink', 'ilink', 'linkloc' ]
-        c_compilers = ['msvc', 'mingw', 'gcc', 'icc' ]
+        linkers = ['mslink', 'gnulink', 'xilink', 'ilink', 'linkloc' ]
+        c_compilers = ['msvc', 'mingw', 'gcc', 'icl', 'icc' ]
         assemblers = ['masm', 'nasm', 'gas', '386asm' ]
         fortran_compilers = ['g77', 'ifl']
         ars = ['mslib', 'ar']
diff --git a/src/engine/SCons/Tool/icl.py b/src/engine/SCons/Tool/icl.py
new file mode 100644 (file)
index 0000000..1b653e3
--- /dev/null
@@ -0,0 +1,88 @@
+"""engine.SCons.Tool.icl
+
+Tool-specific initialization for the Intel C/C++ compiler.
+
+There normally shouldn't be any need to import this module directly.
+It will usually be imported through the generic SCons.Tool.Tool()
+selection method.
+
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os.path
+import string
+
+import SCons.Tool.msvc
+import SCons.Util
+
+# Find Intel compiler:
+# Could enumerate subkeys here to be more flexible.
+def get_intel_compiler_top(version):
+    """
+    Return the main path to the top-level dir of the Intel compiler,
+    using the given version or latest if 0.
+    The compiler will be in <top>/Bin/icl.exe,
+    the include dir is <top>/Include, etc.
+    """
+
+    if version == 0:
+        version = "7.0"                   # XXX: should scan for latest
+
+    if not SCons.Util.can_read_reg:
+        raise SCons.Errors.InternalError, "No Windows registry module was found"
+
+    K = ('Software\\Intel\\' +
+         'Intel(R) C/C++ Compiler for 32-bit apps, Version ' + version)
+    # Note: v5 had slightly different key:
+    #  HKCU\Software\Intel\Intel C/C++ Compiler for 32-bit apps, Version 5.0
+    # Note no (R).
+    try:
+        k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_CURRENT_USER, K)
+    except SCons.Util.RegError:
+        return None
+
+    try:
+        # On my machine, this returns:
+        #  c:\Program Files\Intel\Compiler70
+        top = SCons.Util.RegQueryValueEx(k, "Directory")[0]
+    except SCons.Util.RegError:
+        raise SCons.Errors.InternalError, "%s was not found in the registry."%K
+
+    if os.path.exists(os.path.join(top, "ia32")):
+        top = os.path.join(top, "ia32")
+
+    if not os.path.exists(os.path.join(top, "Bin", "icl.exe")):
+        raise SCons.Errors.InternalError, "Can't find Intel compiler in %s"%top
+
+    return top
+
+
+def generate(env):
+    """Add Builders and construction variables for icl to an Environment."""
+    SCons.Tool.msvc.generate(env)
+
+    try:
+        icltop = get_intel_compiler_top(0)
+    except (SCons.Util.RegError, SCons.Errors.InternalError):
+        icltop = None
+
+    if icltop:
+        env.PrependENVPath('INCLUDE', os.path.join(icltop, 'Include'))
+        env.PrependENVPath('PATH', os.path.join(icltop, 'Bin'))
+
+    env['CC']        = 'icl'
+    env['CXX']        = 'icl'
+    env['LINK']        = 'xilink'
+
+    env['ENV']['INTEL_LICENSE_FILE'] = r'C:\Program Files\Common Files\Intel\Licenses'
+
+def exists(env):
+    try:
+        top = get_intel_compiler_top(0)
+    except (SCons.Util.RegError, SCons.Errors.InternalError):
+        top = None
+
+    if not top:
+        return env.Detect('icl')
+    return top is not None
index c76c47d03e878cc18e9f4421b3530e63608e322e..d66f8e5cd691b26b34051ff384a1d6b91e8947be 100644 (file)
@@ -66,6 +66,7 @@ tools = [
     'hpcc',
     'hplink',
     'icc',
+    'icl',
     'ifl',
     'ilink',
     'jar',