Renamed 'link_static_lib() to 'create_static_lib()', and rewrote it create

a static library (using lib.exe as found by '__init__()', hopefully through
registry entries pointing to DevStudio).
This commit is contained in:
Greg Ward 2000-03-10 01:49:26 +00:00
parent 036c805958
commit 09fc542b27
1 changed files with 15 additions and 25 deletions

View File

@ -168,6 +168,7 @@ class MSVCCompiler (CCompiler) :
self.cc = _find_exe("cl.exe", version) self.cc = _find_exe("cl.exe", version)
self.link = _find_exe("link.exe", version) self.link = _find_exe("link.exe", version)
self.lib = _find_exe("lib.exe", version)
set_path_env_var ('lib', version) set_path_env_var ('lib', version)
set_path_env_var ('include', version) set_path_env_var ('include', version)
path=get_msvc_paths('path', version) path=get_msvc_paths('path', version)
@ -181,6 +182,7 @@ class MSVCCompiler (CCompiler) :
# devstudio not found in the registry # devstudio not found in the registry
self.cc = "cl.exe" self.cc = "cl.exe"
self.link = "link.exe" self.link = "link.exe"
self.lib = "lib.exe"
self.preprocess_options = None self.preprocess_options = None
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3' ] self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3' ]
@ -243,44 +245,32 @@ class MSVCCompiler (CCompiler) :
# compile () # compile ()
# XXX the signature of this method is different from CCompiler and def create_static_lib (self,
# UnixCCompiler -- but those extra parameters (libraries, library_dirs) objects,
# are actually used. So: are they really *needed*, or can they be output_libname,
# ditched? If needed, the CCompiler API will have to change... output_dir=None,
def link_static_lib (self, debug=0,
objects, extra_preargs=None,
output_libname, extra_postargs=None):
output_dir=None,
libraries=None,
library_dirs=None,
debug=0,
extra_preargs=None,
extra_postargs=None):
(objects, output_dir, libraries, library_dirs) = \ (objects, output_dir) = \
self._fix_link_args (objects, output_dir, takes_libs=1, self._fix_link_args (objects, output_dir, takes_libs=0)
libraries=libraries,
library_dirs=library_dirs)
output_filename = \ output_filename = \
self.library_filename (output_libname, output_dir=output_dir) self.library_filename (output_libname, output_dir=output_dir)
if self._need_link (objects, output_filename): if self._need_link (objects, output_filename):
lib_opts = gen_lib_options (libraries, library_dirs, lib_args = objects + ['/OUT:' + output_filename]
"%s.lib", "/LIBPATH:%s")
ld_args = self.ldflags_static + lib_opts + \
objects + ['/OUT:' + output_filename]
if debug: if debug:
pass # XXX what goes here? pass # XXX what goes here?
if extra_preargs: if extra_preargs:
ld_args[:0] = extra_preargs lib_args[:0] = extra_preargs
if extra_postargs: if extra_postargs:
ld_args.extend (extra_postargs) lib_args.extend (extra_postargs)
self.spawn ([self.link] + ld_args) self.spawn ([self.link] + ld_args)
else: else:
self.announce ("skipping %s (up-to-date)" % output_filename) self.announce ("skipping %s (up-to-date)" % output_filename)
# link_static_lib () # create_static_lib ()
def link_shared_lib (self, def link_shared_lib (self,