comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/distutils/fcompiler/compaq.py @ 87:2a2c65a20a8b

Add Python libs and headers
author Chris Cannam
date Wed, 25 Feb 2015 14:05:22 +0000
parents
children
comparison
equal deleted inserted replaced
86:413a9d26189e 87:2a2c65a20a8b
1
2 #http://www.compaq.com/fortran/docs/
3 from __future__ import division, absolute_import, print_function
4
5 import os
6 import sys
7
8 from numpy.distutils.fcompiler import FCompiler
9 from numpy.distutils.compat import get_exception
10 from distutils.errors import DistutilsPlatformError
11
12 compilers = ['CompaqFCompiler']
13 if os.name != 'posix' or sys.platform[:6] == 'cygwin' :
14 # Otherwise we'd get a false positive on posix systems with
15 # case-insensitive filesystems (like darwin), because we'll pick
16 # up /bin/df
17 compilers.append('CompaqVisualFCompiler')
18
19 class CompaqFCompiler(FCompiler):
20
21 compiler_type = 'compaq'
22 description = 'Compaq Fortran Compiler'
23 version_pattern = r'Compaq Fortran (?P<version>[^\s]*).*'
24
25 if sys.platform[:5]=='linux':
26 fc_exe = 'fort'
27 else:
28 fc_exe = 'f90'
29
30 executables = {
31 'version_cmd' : ['<F90>', "-version"],
32 'compiler_f77' : [fc_exe, "-f77rtl", "-fixed"],
33 'compiler_fix' : [fc_exe, "-fixed"],
34 'compiler_f90' : [fc_exe],
35 'linker_so' : ['<F90>'],
36 'archiver' : ["ar", "-cr"],
37 'ranlib' : ["ranlib"]
38 }
39
40 module_dir_switch = '-module ' # not tested
41 module_include_switch = '-I'
42
43 def get_flags(self):
44 return ['-assume no2underscore', '-nomixed_str_len_arg']
45 def get_flags_debug(self):
46 return ['-g', '-check bounds']
47 def get_flags_opt(self):
48 return ['-O4', '-align dcommons', '-assume bigarrays',
49 '-assume nozsize', '-math_library fast']
50 def get_flags_arch(self):
51 return ['-arch host', '-tune host']
52 def get_flags_linker_so(self):
53 if sys.platform[:5]=='linux':
54 return ['-shared']
55 return ['-shared', '-Wl,-expect_unresolved,*']
56
57 class CompaqVisualFCompiler(FCompiler):
58
59 compiler_type = 'compaqv'
60 description = 'DIGITAL or Compaq Visual Fortran Compiler'
61 version_pattern = r'(DIGITAL|Compaq) Visual Fortran Optimizing Compiler'\
62 ' Version (?P<version>[^\s]*).*'
63
64 compile_switch = '/compile_only'
65 object_switch = '/object:'
66 library_switch = '/OUT:' #No space after /OUT:!
67
68 static_lib_extension = ".lib"
69 static_lib_format = "%s%s"
70 module_dir_switch = '/module:'
71 module_include_switch = '/I'
72
73 ar_exe = 'lib.exe'
74 fc_exe = 'DF'
75
76 if sys.platform=='win32':
77 from distutils.msvccompiler import MSVCCompiler
78
79 try:
80 m = MSVCCompiler()
81 m.initialize()
82 ar_exe = m.lib
83 except DistutilsPlatformError:
84 pass
85 except AttributeError:
86 msg = get_exception()
87 if '_MSVCCompiler__root' in str(msg):
88 print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg))
89 else:
90 raise
91 except IOError:
92 e = get_exception()
93 if not "vcvarsall.bat" in str(e):
94 print("Unexpected IOError in", __file__)
95 raise e
96 except ValueError:
97 e = get_exception()
98 if not "path']" in str(e):
99 print("Unexpected ValueError in", __file__)
100 raise e
101
102 executables = {
103 'version_cmd' : ['<F90>', "/what"],
104 'compiler_f77' : [fc_exe, "/f77rtl", "/fixed"],
105 'compiler_fix' : [fc_exe, "/fixed"],
106 'compiler_f90' : [fc_exe],
107 'linker_so' : ['<F90>'],
108 'archiver' : [ar_exe, "/OUT:"],
109 'ranlib' : None
110 }
111
112 def get_flags(self):
113 return ['/nologo', '/MD', '/WX', '/iface=(cref,nomixed_str_len_arg)',
114 '/names:lowercase', '/assume:underscore']
115 def get_flags_opt(self):
116 return ['/Ox', '/fast', '/optimize:5', '/unroll:0', '/math_library:fast']
117 def get_flags_arch(self):
118 return ['/threads']
119 def get_flags_debug(self):
120 return ['/debug']
121
122 if __name__ == '__main__':
123 from distutils import log
124 log.set_verbosity(2)
125 from numpy.distutils.fcompiler import new_fcompiler
126 compiler = new_fcompiler(compiler='compaq')
127 compiler.customize()
128 print(compiler.get_version())