Added 'debug' option, and changed compile/link calls to use it.

This commit is contained in:
Greg Ward 2000-02-09 02:20:14 +00:00
parent 324620015d
commit e8c6ce4684
3 changed files with 30 additions and 10 deletions

View File

@ -28,7 +28,9 @@
class BuildLib (Command):
options = []
options = [('debug', 'g',
"compile with debugging information"),
]
def set_default_options (self):
# List of libraries to build
@ -38,10 +40,13 @@ def set_default_options (self):
self.include_dirs = None
self.define = None
self.undef = None
self.debug = None
# set_default_options()
def set_final_options (self):
self.set_undefined_options ('build',
('debug', 'debug'))
self.libraries = self.distribution.libraries
if self.include_dirs is None:
self.include_dirs = self.distribution.include_dirs or []
@ -146,12 +151,13 @@ def build_libraries (self, libraries):
objects = self.compiler.compile (sources,
macros=macros,
include_dirs=include_dirs,
output_dir=lib_dir)
output_dir=lib_dir,
debug=self.debug)
# Now "link" the object files together into a static library.
# (On Unix at least, this isn't really linking -- it just
# builds an archive. Whatever.)
self.compiler.link_static_lib (objects, lib_name)
self.compiler.link_static_lib (objects, lib_name, debug=self.debug)
# for libraries

View File

@ -58,6 +58,8 @@ class BuildExt (Command):
"directories to search for shared C libraries at runtime"),
('link-objects=', 'O',
"extra explicit link objects to include in the link"),
('debug', 'g',
"compile/link with debugging information"),
]
@ -73,12 +75,15 @@ def set_default_options (self):
self.library_dirs = None
self.rpath = None
self.link_objects = None
self.debug = None
def set_final_options (self):
from distutils import sysconfig
self.set_undefined_options ('build', ('build_platlib', 'build_dir'))
self.set_undefined_options ('build',
('build_platlib', 'build_dir'),
('debug', 'debug'))
if self.package is None:
self.package = self.distribution.ext_package
@ -223,7 +228,8 @@ def build_extensions (self, extensions):
include_dirs = build_info.get ('include_dirs')
self.compiler.compile (sources,
macros=macros,
include_dirs=include_dirs)
include_dirs=include_dirs,
debug=self.debug)
# Now link the object files together into a "shared object" --
# of course, first we have to figure out all the other things
@ -236,7 +242,8 @@ def build_extensions (self, extensions):
library_dirs = build_info.get ('library_dirs')
extra_args = build_info.get ('extra_link_args') or []
if self.compiler.compiler_type == 'msvc':
extra_args.append ('/export:init%s' % extension_name)
mod_name = string.split (extension_name, '.')[-1]
extra_args.append ('/export:init%s' % mod_name)
ext_filename = self.extension_filename \
(extension_name, self.package)
@ -246,7 +253,8 @@ def build_extensions (self, extensions):
self.compiler.link_shared_object (objects, ext_filename,
libraries=libraries,
library_dirs=library_dirs,
extra_postargs=extra_args)
extra_postargs=extra_args,
debug=self.debug)
# build_extensions ()

View File

@ -28,7 +28,9 @@
class BuildLib (Command):
options = []
options = [('debug', 'g',
"compile with debugging information"),
]
def set_default_options (self):
# List of libraries to build
@ -38,10 +40,13 @@ def set_default_options (self):
self.include_dirs = None
self.define = None
self.undef = None
self.debug = None
# set_default_options()
def set_final_options (self):
self.set_undefined_options ('build',
('debug', 'debug'))
self.libraries = self.distribution.libraries
if self.include_dirs is None:
self.include_dirs = self.distribution.include_dirs or []
@ -146,12 +151,13 @@ def build_libraries (self, libraries):
objects = self.compiler.compile (sources,
macros=macros,
include_dirs=include_dirs,
output_dir=lib_dir)
output_dir=lib_dir,
debug=self.debug)
# Now "link" the object files together into a static library.
# (On Unix at least, this isn't really linking -- it just
# builds an archive. Whatever.)
self.compiler.link_static_lib (objects, lib_name)
self.compiler.link_static_lib (objects, lib_name, debug=self.debug)
# for libraries