diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2007-05-19 19:44:42 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2007-05-19 19:44:42 +0000 |
commit | 02df1be4949d7583a662bca6c0fe61d7afc334a7 (patch) | |
tree | ad1a1e051c32810640d9c8613bdad50275ea0de6 /numpy/distutils/command/build_ext.py | |
parent | 0168bce06a2d0266a2d337a2f587ec1327d19fb4 (diff) | |
download | numpy-02df1be4949d7583a662bca6c0fe61d7afc334a7.tar.gz |
Clean up and completed (hopefully) MSVC support.
Diffstat (limited to 'numpy/distutils/command/build_ext.py')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 6cc7ce5bd..93bb3464a 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -391,6 +391,33 @@ class build_ext (old_build_ext): def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, c_library_dirs): if fcompiler is None: return + + for libname in c_libraries: + if libname.startswith('msvc'): continue + fileexists = False + for libdir in c_library_dirs or []: + libfile = os.path.join(libdir,'%s.lib' % (libname)) + if os.path.isfile(libfile): + fileexists = True + break + if fileexists: continue + # make g77-compiled static libs available to MSVC + fileexists = False + for libdir in c_library_dirs: + libfile = os.path.join(libdir,'lib%s.a' % (libname)) + if os.path.isfile(libfile): + # copy libname.a file to name.lib so that MSVC linker + # can find it + libfile2 = os.path.join(self.build_temp, libname + '.lib') + copy_file(libfile, libfile2) + if self.build_temp not in c_library_dirs: + c_library_dirs.append(self.build_temp) + fileexists = True + break + if fileexists: continue + log.warn('could not find library %r in directories %s' \ + % (libname, c_library_dirs)) + # Always use system linker when using MSVC compiler. f_lib_dirs = [] for dir in fcompiler.library_dirs: @@ -404,17 +431,16 @@ class build_ext (old_build_ext): c_library_dirs.extend(f_lib_dirs) # make g77-compiled static libs available to MSVC - lib_added = False for lib in fcompiler.libraries: - if not lib.startswith('msvcr'): + if not lib.startswith('msvc'): c_libraries.append(lib) p = combine_paths(f_lib_dirs, 'lib' + lib + '.a') if p: dst_name = os.path.join(self.build_temp, lib + '.lib') - copy_file(p[0], dst_name) - if not lib_added: + if not os.path.isfile(dst_name): + copy_file(p[0], dst_name) + if self.build_temp not in c_library_dirs: c_library_dirs.append(self.build_temp) - lib_added = True return def get_source_files (self): |