diff options
author | carlkl <cmkleffner@gmail.com> | 2015-02-20 01:11:02 +0100 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-02-27 08:41:11 -0700 |
commit | ae438c3707ccb451c6f0d8150388f9d75a9b5375 (patch) | |
tree | c482c1474a0edc7d1bd1811ce7971a03b1b1a6f7 /numpy/distutils/fcompiler | |
parent | 06af9918f6bf03b8d818ec834f9fb48db57d1489 (diff) | |
download | numpy-ae438c3707ccb451c6f0d8150388f9d75a9b5375.tar.gz |
BLD: Add mingw-w64 support for the mingw64static option.
Diffstat (limited to 'numpy/distutils/fcompiler')
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index ccd5e8d48..16ad73e5c 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -21,6 +21,8 @@ TARGET_R = re.compile("Target: ([a-zA-Z0-9_\-]*)") # XXX: handle cross compilation def is_win64(): return sys.platform == "win32" and platform.architecture()[0] == "64bit" +def is_win32(): + return sys.platform == "win32" and platform.architecture()[0] == "32bit" if is_win64(): #_EXTRAFLAGS = ["-fno-leading-underscore"] @@ -130,7 +132,7 @@ class GnuFCompiler(FCompiler): opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) else: - opt.append("-shared") + opt.append("-shared -Wl,-gc-sections -Wl,-s") if sys.platform.startswith('sunos'): # SunOS often has dynamically loaded symbols defined in the # static library libg2c.a The linker doesn't like this. To @@ -200,9 +202,17 @@ class GnuFCompiler(FCompiler): # With this compiler version building Fortran BLAS/LAPACK # with -O3 caused failures in lib.lapack heevr,syevr tests. opt = ['-O2'] + elif v and v>='4.6.0': + if is_win32(): + # use -mincoming-stack-boundary=2 + # due to the change to 16 byte stack alignment since GCC 4.6 + # but 32 bit Windows ABI defines 4 bytes stack alignment + opt = ['-O2 -march=core2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2'] + else: + opt = ['-O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2'] else: - opt = ['-O3'] - opt.append('-funroll-loops') + opt = ['-O2'] + # opt.append() return opt def _c_arch_flags(self): @@ -349,10 +359,7 @@ class Gnu95FCompiler(GnuFCompiler): return "" def get_flags_opt(self): - if is_win64(): - return ['-O0'] - else: - return GnuFCompiler.get_flags_opt(self) + return GnuFCompiler.get_flags_opt(self) def _can_target(cmd, arch): """Return true is the command supports the -arch flag for the given @@ -378,9 +385,13 @@ if __name__ == '__main__': from distutils import log log.set_verbosity(2) - compiler = GnuFCompiler() - compiler.customize() - print(compiler.get_version()) + try: + compiler = GnuFCompiler() + compiler.customize() + print(compiler.get_version()) + except Exception: + msg = get_exception() + print(msg) try: compiler = Gnu95FCompiler() |