diff options
author | cookedm <cookedm@localhost> | 2007-04-22 21:12:57 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2007-04-22 21:12:57 +0000 |
commit | 03b278bc04b508e8c48bc2df80113d23b2a039c4 (patch) | |
tree | 78bf34a9a9fe2e5d59a7f91e0cd324e553d8f3c6 /numpy/distutils/command/build_ext.py | |
parent | 06cc6933dfdae2f9273c3040b2677e2206221647 (diff) | |
download | numpy-03b278bc04b508e8c48bc2df80113d23b2a039c4.tar.gz |
Some distutils work:
- Add better support for C++ in numpy.distutils. Instead of munging the
C compiler command, build_clib and build_ext call the new
Compiler.cxx_compiler() method to get a version of the compiler suitable for
C++ (this also takes care of the special needs of AIX).
- If config_fc is specified in the Extension definition, merge that info
instead of replacing it (otherwise, the name of the Fortran compiler is
overwritten). This is done at the key level (ex., compiler options are
replaced instead of appended).
- clean up compiler.py a bit
- clean up linking in build_ext
Diffstat (limited to 'numpy/distutils/command/build_ext.py')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 0e804e19e..466462c56 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -201,17 +201,15 @@ class build_ext (old_build_ext): if cxx_sources: log.info("compiling C++ sources") - old_compiler = self.compiler.compiler_so[0] - self.compiler.compiler_so[0] = self.compiler.compiler_cxx[0] + cxx_compiler = self.compiler.cxx_compiler() - c_objects += self.compiler.compile(cxx_sources, + c_objects += cxx_compiler.compile(cxx_sources, output_dir=output_dir, macros=macros, include_dirs=include_dirs, debug=self.debug, extra_postargs=extra_args, **kws) - self.compiler.compiler_so[0] = old_compiler check_for_f90_modules = not not fmodule_sources @@ -272,10 +270,7 @@ class build_ext (old_build_ext): objects.extend(ext.extra_objects) extra_args = ext.extra_link_args or [] - try: - old_linker_so_0 = self.compiler.linker_so[0] - except: - pass + linker = self.compiler.link_shared_object use_fortran_linker = getattr(ext,'language','c') in ['f77','f90'] \ and self.fcompiler is not None @@ -308,37 +303,30 @@ class build_ext (old_build_ext): if cxx_sources: # XXX: Which linker should be used, Fortran or C++? log.warn('mixing Fortran and C++ is untested') - link = self.fcompiler.link_shared_object + linker = self.fcompiler.link_shared_object language = ext.language or self.fcompiler.detect_language(f_sources) else: - link = self.compiler.link_shared_object + linker = self.compiler.link_shared_object if sys.version[:3]>='2.3': language = ext.language or self.compiler.detect_language(sources) else: language = ext.language if cxx_sources: - self.compiler.linker_so[0] = self.compiler.compiler_cxx[0] + linker = self.compiler.cxx_compiler().link_shared_object if sys.version[:3]>='2.3': kws = {'target_lang':language} else: kws = {} - link(objects, ext_filename, - libraries=self.get_libraries(ext) + c_libraries + clib_libraries, - library_dirs=ext.library_dirs + c_library_dirs + clib_library_dirs, - runtime_library_dirs=ext.runtime_library_dirs, - extra_postargs=extra_args, - export_symbols=self.get_export_symbols(ext), - debug=self.debug, - build_temp=self.build_temp,**kws) - - try: - self.compiler.linker_so[0] = old_linker_so_0 - except: - pass - - return + linker(objects, ext_filename, + libraries=self.get_libraries(ext) + c_libraries + clib_libraries, + library_dirs=ext.library_dirs+c_library_dirs+clib_library_dirs, + runtime_library_dirs=ext.runtime_library_dirs, + extra_postargs=extra_args, + export_symbols=self.get_export_symbols(ext), + debug=self.debug, + build_temp=self.build_temp,**kws) def _libs_with_msvc_and_fortran(self, c_libraries, c_library_dirs): # Always use system linker when using MSVC compiler. |