summaryrefslogtreecommitdiff
path: root/numpy/distutils/intelccompiler.py
blob: aed652ee6d368c54d93e5a5ef8f74e60e819b96a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from __future__ import division, absolute_import, print_function

from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.msvc9compiler import MSVCCompiler
from numpy.distutils.ccompiler import simple_version_match


class IntelCCompiler(UnixCCompiler):
    """A modified Intel compiler compatible with a GCC-built Python."""
    compiler_type = 'intel'
    cc_exe = 'icc'
    cc_args = 'fPIC'

    def __init__(self, verbose=0, dry_run=0, force=0):
        UnixCCompiler.__init__(self, verbose, dry_run, force)
        self.cc_exe = 'icc -fPIC'
        compiler = self.cc_exe
        self.set_executables(compiler=compiler,
                             compiler_so=compiler,
                             compiler_cxx=compiler,
                             linker_exe=compiler,
                             linker_so=compiler + ' -shared')


class IntelItaniumCCompiler(IntelCCompiler):
    compiler_type = 'intele'

    # On Itanium, the Intel Compiler used to be called ecc, let's search for
    # it (now it's also icc, so ecc is last in the search).
    for cc_exe in map(find_executable, ['icc', 'ecc']):
        if cc_exe:
            break


class IntelEM64TCCompiler(UnixCCompiler):
    """
    A modified Intel x86_64 compiler compatible with a 64bit GCC-built Python.
    """
    compiler_type = 'intelem'
    cc_exe = 'icc -m64 -fPIC'
    cc_args = "-fPIC"
    def __init__(self, verbose=0, dry_run=0, force=0):
        UnixCCompiler.__init__(self, verbose, dry_run, force)
        self.cc_exe = 'icc -m64 -fPIC'
        compiler = self.cc_exe
        self.set_executables(compiler=compiler,
                             compiler_so=compiler,
                             compiler_cxx=compiler,
                             linker_exe=compiler,
                             linker_so=compiler + ' -shared')


class IntelCCompilerW(MSVCCompiler):
    """
    A modified Intel compiler on Windows compatible with an MSVC-built Python.
    """
    compiler_type = 'intelw'

    def __init__(self, verbose=0, dry_run=0, force=0):
        MSVCCompiler.__init__(self, verbose, dry_run, force)
        version_match = simple_version_match(start='Intel\(R\).*?32,')
        self.__version = version_match

    def initialize(self, plat_name=None):
        MSVCCompiler.initialize(self, plat_name)
        self.cc = self.find_exe("icl.exe")
        self.linker = self.find_exe("xilink")
        self.compile_options = ['/nologo', '/O3', '/MD', '/W3']
        self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/Z7',
                                      '/D_DEBUG']


class IntelEM64TCCompilerW(IntelCCompilerW):
    """
    A modified Intel x86_64 compiler compatible with a 64bit MSVC-built Python.
    """
    compiler_type = 'intelemw'

    def __init__(self, verbose=0, dry_run=0, force=0):
        MSVCCompiler.__init__(self, verbose, dry_run, force)
        version_match = simple_version_match(start='Intel\(R\).*?64,')
        self.__version = version_match