blob: b6ff432ce341062d2416d36aee0809d007c984cc [file] [log] [blame]
Greg Warddbd12761999-08-29 18:15:07 +00001"""distutils.ccompiler
2
3Contains MSVCCompiler, an implementation of the abstract CCompiler class
Greg Warddf178f91999-09-29 12:29:10 +00004for the Microsoft Visual Studio."""
Greg Warddbd12761999-08-29 18:15:07 +00005
6
7# created 1999/08/19, Perry Stoll
Greg Ward32c4a8a2000-03-06 03:40:29 +00008# hacked by Robin Becker and Thomas Heller to do a better job of
9# finding DevStudio (through the registry)
10
Greg Ward3ce77fd2000-03-02 01:49:45 +000011__revision__ = "$Id$"
Greg Warddbd12761999-08-29 18:15:07 +000012
Greg Ward32c4a8a2000-03-06 03:40:29 +000013import sys, os, string
14from types import *
Greg Warddbd12761999-08-29 18:15:07 +000015from distutils.errors import *
Greg Ward3d50b901999-09-08 02:36:01 +000016from distutils.ccompiler import \
17 CCompiler, gen_preprocess_options, gen_lib_options
Greg Warddbd12761999-08-29 18:15:07 +000018
Greg Ward62e33932000-02-10 02:52:42 +000019
Greg Ward7642f5c2000-03-31 16:47:40 +000020_can_read_reg = 0
21try:
22 import winreg
Greg Ward7642f5c2000-03-31 16:47:40 +000023 _can_read_reg = 1
Greg Ward19ce1662000-03-31 19:04:25 +000024 hkey_mod = winreg
25
26 RegOpenKeyEx = winreg.OpenKeyEx
27 RegEnumKey = winreg.EnumKey
28 RegEnumValue = winreg.EnumValue
29 RegError = winreg.error
30
Greg Ward7642f5c2000-03-31 16:47:40 +000031except ImportError:
32 try:
33 import win32api
34 import win32con
Greg Ward7642f5c2000-03-31 16:47:40 +000035 _can_read_reg = 1
Greg Ward1027e3f2000-03-31 16:53:42 +000036 hkey_mod = win32con
Greg Ward19ce1662000-03-31 19:04:25 +000037
38 RegOpenKeyEx = win32api.RegOpenKeyEx
39 RegEnumKey = win32api.RegEnumKey
40 RegEnumValue = win32api.RegEnumValue
41 RegError = win32api.error
42
Greg Ward7642f5c2000-03-31 16:47:40 +000043 except ImportError:
44 pass
Greg Ward1027e3f2000-03-31 16:53:42 +000045
46if _can_read_reg:
47 HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT
48 HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
49 HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER
50 HKEY_USERS = hkey_mod.HKEY_USERS
Greg Ward1027e3f2000-03-31 16:53:42 +000051
Greg Ward7642f5c2000-03-31 16:47:40 +000052
53
Greg Ward62e33932000-02-10 02:52:42 +000054def get_devstudio_versions ():
Greg Ward62e33932000-02-10 02:52:42 +000055 """Get list of devstudio versions from the Windows registry. Return a
Greg Ward69988092000-02-11 02:47:15 +000056 list of strings containing version numbers; the list will be
Greg Ward62e33932000-02-10 02:52:42 +000057 empty if we were unable to access the registry (eg. couldn't import
58 a registry-access module) or the appropriate registry keys weren't
Greg Ward69988092000-02-11 02:47:15 +000059 found."""
60
Greg Ward7642f5c2000-03-31 16:47:40 +000061 if not _can_read_reg:
Greg Ward62e33932000-02-10 02:52:42 +000062 return []
Greg Ward1b9c6f72000-02-08 02:39:44 +000063
64 K = 'Software\\Microsoft\\Devstudio'
65 L = []
Greg Ward1027e3f2000-03-31 16:53:42 +000066 for base in (HKEY_CLASSES_ROOT,
67 HKEY_LOCAL_MACHINE,
68 HKEY_CURRENT_USER,
69 HKEY_USERS):
Greg Ward1b9c6f72000-02-08 02:39:44 +000070 try:
Greg Ward1027e3f2000-03-31 16:53:42 +000071 k = RegOpenKeyEx(base,K)
Greg Ward1b9c6f72000-02-08 02:39:44 +000072 i = 0
73 while 1:
74 try:
Greg Ward1027e3f2000-03-31 16:53:42 +000075 p = RegEnumKey(k,i)
Greg Ward1b9c6f72000-02-08 02:39:44 +000076 if p[0] in '123456789' and p not in L:
77 L.append(p)
Greg Ward1027e3f2000-03-31 16:53:42 +000078 except RegError:
Greg Ward1b9c6f72000-02-08 02:39:44 +000079 break
80 i = i + 1
Greg Ward1027e3f2000-03-31 16:53:42 +000081 except RegError:
Greg Ward1b9c6f72000-02-08 02:39:44 +000082 pass
83 L.sort()
84 L.reverse()
85 return L
86
Greg Ward62e33932000-02-10 02:52:42 +000087# get_devstudio_versions ()
88
89
90def get_msvc_paths (path, version='6.0', platform='x86'):
Greg Ward69988092000-02-11 02:47:15 +000091 """Get a list of devstudio directories (include, lib or path). Return
92 a list of strings; will be empty list if unable to access the
93 registry or appropriate registry keys not found."""
94
Greg Ward7642f5c2000-03-31 16:47:40 +000095 if not _can_read_reg:
Greg Ward69988092000-02-11 02:47:15 +000096 return []
Greg Ward1b9c6f72000-02-08 02:39:44 +000097
98 L = []
Greg Ward62e33932000-02-10 02:52:42 +000099 if path=='lib':
100 path= 'Library'
Greg Ward1b9c6f72000-02-08 02:39:44 +0000101 path = string.upper(path + ' Dirs')
Greg Ward62e33932000-02-10 02:52:42 +0000102 K = ('Software\\Microsoft\\Devstudio\\%s\\' +
103 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \
104 (version,platform)
Greg Ward1027e3f2000-03-31 16:53:42 +0000105 for base in (HKEY_CLASSES_ROOT,
106 HKEY_LOCAL_MACHINE,
107 HKEY_CURRENT_USER,
108 HKEY_USERS):
Greg Ward1b9c6f72000-02-08 02:39:44 +0000109 try:
Greg Ward1027e3f2000-03-31 16:53:42 +0000110 k = RegOpenKeyEx(base,K)
Greg Ward1b9c6f72000-02-08 02:39:44 +0000111 i = 0
112 while 1:
113 try:
Greg Ward1027e3f2000-03-31 16:53:42 +0000114 (p,v,t) = RegEnumValue(k,i)
Greg Ward62e33932000-02-10 02:52:42 +0000115 if string.upper(p) == path:
Greg Ward1b9c6f72000-02-08 02:39:44 +0000116 V = string.split(v,';')
117 for v in V:
Greg Ward62e33932000-02-10 02:52:42 +0000118 if v == '' or v in L: continue
Greg Ward1b9c6f72000-02-08 02:39:44 +0000119 L.append(v)
120 break
121 i = i + 1
Greg Ward1027e3f2000-03-31 16:53:42 +0000122 except RegError:
Greg Ward1b9c6f72000-02-08 02:39:44 +0000123 break
Greg Ward1027e3f2000-03-31 16:53:42 +0000124 except RegError:
Greg Ward1b9c6f72000-02-08 02:39:44 +0000125 pass
126 return L
127
Greg Ward62e33932000-02-10 02:52:42 +0000128# get_msvc_paths()
129
130
Greg Ward69988092000-02-11 02:47:15 +0000131def find_exe (exe, version_number):
132 """Try to find an MSVC executable program 'exe' (from version
133 'version_number' of MSVC) in several places: first, one of the MSVC
134 program search paths from the registry; next, the directories in the
135 PATH environment variable. If any of those work, return an absolute
136 path that is known to exist. If none of them work, just return the
137 original program name, 'exe'."""
Greg Ward1b9c6f72000-02-08 02:39:44 +0000138
Greg Ward69988092000-02-11 02:47:15 +0000139 for p in get_msvc_paths ('path', version_number):
140 fn = os.path.join (os.path.abspath(p), exe)
141 if os.path.isfile(fn):
142 return fn
143
144 # didn't find it; try existing path
145 for p in string.split (os.environ['Path'],';'):
146 fn = os.path.join(os.path.abspath(p),exe)
147 if os.path.isfile(fn):
148 return fn
149
150 return exe # last desperate hope
Greg Ward1b9c6f72000-02-08 02:39:44 +0000151
Greg Ward62e33932000-02-10 02:52:42 +0000152
Greg Ward5de8cee2000-02-11 02:52:39 +0000153def set_path_env_var (name, version_number):
154 """Set environment variable 'name' to an MSVC path type value obtained
155 from 'get_msvc_paths()'. This is equivalent to a SET command prior
156 to execution of spawned commands."""
Greg Ward69988092000-02-11 02:47:15 +0000157
Greg Ward5de8cee2000-02-11 02:52:39 +0000158 p = get_msvc_paths (name, version_number)
Greg Ward62e33932000-02-10 02:52:42 +0000159 if p:
Greg Ward5de8cee2000-02-11 02:52:39 +0000160 os.environ[name] = string.join (p,';')
Greg Ward62e33932000-02-10 02:52:42 +0000161
Greg Warddbd12761999-08-29 18:15:07 +0000162
Greg Ward3d50b901999-09-08 02:36:01 +0000163class MSVCCompiler (CCompiler) :
164 """Concrete class that implements an interface to Microsoft Visual C++,
165 as defined by the CCompiler abstract class."""
Greg Warddbd12761999-08-29 18:15:07 +0000166
Greg Warddf178f91999-09-29 12:29:10 +0000167 compiler_type = 'msvc'
168
Greg Ward32c4a8a2000-03-06 03:40:29 +0000169 # Private class data (need to distinguish C from C++ source for compiler)
170 _c_extensions = ['.c']
171 _cpp_extensions = ['.cc','.cpp']
172
173 # Needed for the filename generation methods provided by the
174 # base class, CCompiler.
175 src_extensions = _c_extensions + _cpp_extensions
176 obj_extension = '.obj'
177 static_lib_extension = '.lib'
178 shared_lib_extension = '.dll'
179 static_lib_format = shared_lib_format = '%s%s'
180 exe_extension = '.exe'
181
182
Greg Warddbd12761999-08-29 18:15:07 +0000183 def __init__ (self,
184 verbose=0,
Greg Wardc74138d1999-10-03 20:47:52 +0000185 dry_run=0,
186 force=0):
Greg Warddbd12761999-08-29 18:15:07 +0000187
Greg Wardc74138d1999-10-03 20:47:52 +0000188 CCompiler.__init__ (self, verbose, dry_run, force)
Greg Ward5de8cee2000-02-11 02:52:39 +0000189 versions = get_devstudio_versions ()
Greg Ward69988092000-02-11 02:47:15 +0000190
Greg Ward5de8cee2000-02-11 02:52:39 +0000191 if versions:
192 version = versions[0] # highest version
Greg Ward69988092000-02-11 02:47:15 +0000193
Greg Ward41b4dd62000-03-29 04:13:00 +0000194 self.cc = find_exe("cl.exe", version)
195 self.link = find_exe("link.exe", version)
196 self.lib = find_exe("lib.exe", version)
Greg Ward5de8cee2000-02-11 02:52:39 +0000197 set_path_env_var ('lib', version)
198 set_path_env_var ('include', version)
199 path=get_msvc_paths('path', version)
Greg Ward69988092000-02-11 02:47:15 +0000200 try:
201 for p in string.split(os.environ['path'],';'):
202 path.append(p)
203 except KeyError:
204 pass
205 os.environ['path'] = string.join(path,';')
206 else:
207 # devstudio not found in the registry
208 self.cc = "cl.exe"
209 self.link = "link.exe"
Greg Ward09fc5422000-03-10 01:49:26 +0000210 self.lib = "lib.exe"
Greg Ward69988092000-02-11 02:47:15 +0000211
Greg Warddbd12761999-08-29 18:15:07 +0000212 self.preprocess_options = None
Greg Ward69988092000-02-11 02:47:15 +0000213 self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3' ]
Greg Ward32c4a8a2000-03-06 03:40:29 +0000214 self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/Z7', '/D_DEBUG']
Greg Warddbd12761999-08-29 18:15:07 +0000215
Greg Ward1b9c6f72000-02-08 02:39:44 +0000216 self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO']
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000217 self.ldflags_shared_debug = [
218 '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG'
219 ]
Greg Warddbd12761999-08-29 18:15:07 +0000220 self.ldflags_static = [ '/nologo']
221
Greg Warddbd12761999-08-29 18:15:07 +0000222
223 # -- Worker methods ------------------------------------------------
Greg Warddbd12761999-08-29 18:15:07 +0000224
Greg Warddbd12761999-08-29 18:15:07 +0000225 def compile (self,
226 sources,
Greg Warddf178f91999-09-29 12:29:10 +0000227 output_dir=None,
Greg Warddbd12761999-08-29 18:15:07 +0000228 macros=None,
Greg Ward0bdd90a1999-12-12 17:19:58 +0000229 include_dirs=None,
Greg Ward386b8442000-02-09 02:18:39 +0000230 debug=0,
Greg Warddf178f91999-09-29 12:29:10 +0000231 extra_preargs=None,
232 extra_postargs=None):
Greg Warddbd12761999-08-29 18:15:07 +0000233
Greg Ward32c4a8a2000-03-06 03:40:29 +0000234 (output_dir, macros, include_dirs) = \
235 self._fix_compile_args (output_dir, macros, include_dirs)
236 (objects, skip_sources) = self._prep_compile (sources, output_dir)
Greg Warddbd12761999-08-29 18:15:07 +0000237
Greg Ward32c4a8a2000-03-06 03:40:29 +0000238 if extra_postargs is None:
239 extra_postargs = []
Greg Warddbd12761999-08-29 18:15:07 +0000240
Greg Ward32c4a8a2000-03-06 03:40:29 +0000241 pp_opts = gen_preprocess_options (macros, include_dirs)
242 compile_opts = extra_preargs or []
243 compile_opts.append ('/c')
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000244 if debug:
Greg Ward32c4a8a2000-03-06 03:40:29 +0000245 compile_opts.extend (self.compile_options_debug)
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000246 else:
Greg Ward32c4a8a2000-03-06 03:40:29 +0000247 compile_opts.extend (self.compile_options)
Greg Warddbd12761999-08-29 18:15:07 +0000248
Greg Ward32c4a8a2000-03-06 03:40:29 +0000249 for i in range (len (sources)):
250 src = sources[i] ; obj = objects[i]
251 ext = (os.path.splitext (src))[1]
Greg Warddbd12761999-08-29 18:15:07 +0000252
Greg Ward32c4a8a2000-03-06 03:40:29 +0000253 if skip_sources[src]:
254 self.announce ("skipping %s (%s up-to-date)" % (src, obj))
255 else:
256 if ext in self._c_extensions:
257 input_opt = "/Tc" + src
258 elif ext in self._cpp_extensions:
259 input_opt = "/Tp" + src
Greg Warddbd12761999-08-29 18:15:07 +0000260
Greg Ward32c4a8a2000-03-06 03:40:29 +0000261 output_opt = "/Fo" + obj
Greg Warddbd12761999-08-29 18:15:07 +0000262
Greg Ward32c4a8a2000-03-06 03:40:29 +0000263 self.mkpath (os.path.dirname (obj))
264 self.spawn ([self.cc] + compile_opts + pp_opts +
265 [input_opt, output_opt] +
266 extra_postargs)
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000267
Greg Ward32c4a8a2000-03-06 03:40:29 +0000268 return objects
Greg Warddbd12761999-08-29 18:15:07 +0000269
Greg Ward32c4a8a2000-03-06 03:40:29 +0000270 # compile ()
Greg Ward3d50b901999-09-08 02:36:01 +0000271
272
Greg Ward09fc5422000-03-10 01:49:26 +0000273 def create_static_lib (self,
274 objects,
275 output_libname,
276 output_dir=None,
277 debug=0,
278 extra_preargs=None,
279 extra_postargs=None):
Greg Warddbd12761999-08-29 18:15:07 +0000280
Greg Ward2f557a22000-03-26 21:42:28 +0000281 (objects, output_dir) = self._fix_object_args (objects, output_dir)
Greg Ward32c4a8a2000-03-06 03:40:29 +0000282 output_filename = \
283 self.library_filename (output_libname, output_dir=output_dir)
Greg Warddbd12761999-08-29 18:15:07 +0000284
Greg Ward32c4a8a2000-03-06 03:40:29 +0000285 if self._need_link (objects, output_filename):
Greg Ward09fc5422000-03-10 01:49:26 +0000286 lib_args = objects + ['/OUT:' + output_filename]
Greg Ward32c4a8a2000-03-06 03:40:29 +0000287 if debug:
288 pass # XXX what goes here?
289 if extra_preargs:
Greg Ward09fc5422000-03-10 01:49:26 +0000290 lib_args[:0] = extra_preargs
Greg Ward32c4a8a2000-03-06 03:40:29 +0000291 if extra_postargs:
Greg Ward09fc5422000-03-10 01:49:26 +0000292 lib_args.extend (extra_postargs)
Greg Ward32c4a8a2000-03-06 03:40:29 +0000293 self.spawn ([self.link] + ld_args)
294 else:
295 self.announce ("skipping %s (up-to-date)" % output_filename)
Greg Warddbd12761999-08-29 18:15:07 +0000296
Greg Ward09fc5422000-03-10 01:49:26 +0000297 # create_static_lib ()
Greg Warddbd12761999-08-29 18:15:07 +0000298
299
300 def link_shared_lib (self,
301 objects,
302 output_libname,
Greg Warddf178f91999-09-29 12:29:10 +0000303 output_dir=None,
Greg Warddbd12761999-08-29 18:15:07 +0000304 libraries=None,
305 library_dirs=None,
Greg Ward2f557a22000-03-26 21:42:28 +0000306 runtime_library_dirs=None,
Greg Ward5299b6a2000-05-20 13:23:21 +0000307 export_symbols=None,
Greg Ward386b8442000-02-09 02:18:39 +0000308 debug=0,
Greg Warddf178f91999-09-29 12:29:10 +0000309 extra_preargs=None,
310 extra_postargs=None):
311
Greg Warddf178f91999-09-29 12:29:10 +0000312 self.link_shared_object (objects,
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000313 self.shared_library_name(output_libname),
314 output_dir=output_dir,
315 libraries=libraries,
316 library_dirs=library_dirs,
Greg Ward5299b6a2000-05-20 13:23:21 +0000317 runtime_library_dirs=runtime_library_dirs,
318 export_symbols=export_symbols,
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000319 debug=debug,
320 extra_preargs=extra_preargs,
321 extra_postargs=extra_postargs)
322
Greg Warddbd12761999-08-29 18:15:07 +0000323
324 def link_shared_object (self,
325 objects,
326 output_filename,
Greg Warddf178f91999-09-29 12:29:10 +0000327 output_dir=None,
Greg Warddbd12761999-08-29 18:15:07 +0000328 libraries=None,
329 library_dirs=None,
Greg Ward2f557a22000-03-26 21:42:28 +0000330 runtime_library_dirs=None,
Greg Ward5299b6a2000-05-20 13:23:21 +0000331 export_symbols=None,
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000332 debug=0,
Greg Warddf178f91999-09-29 12:29:10 +0000333 extra_preargs=None,
334 extra_postargs=None):
Greg Ward32c4a8a2000-03-06 03:40:29 +0000335
Greg Ward2f557a22000-03-26 21:42:28 +0000336 (objects, output_dir) = self._fix_object_args (objects, output_dir)
337 (libraries, library_dirs, runtime_library_dirs) = \
338 self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
339
Greg Wardf70c6032000-04-19 02:16:49 +0000340 if runtime_library_dirs:
Greg Ward2f557a22000-03-26 21:42:28 +0000341 self.warn ("I don't know what to do with 'runtime_library_dirs': "
342 + str (runtime_library_dirs))
Greg Warddbd12761999-08-29 18:15:07 +0000343
Greg Wardd03f88a2000-03-18 15:19:51 +0000344 lib_opts = gen_lib_options (self,
Greg Ward2f557a22000-03-26 21:42:28 +0000345 library_dirs, runtime_library_dirs,
Greg Wardd03f88a2000-03-18 15:19:51 +0000346 libraries)
Greg Ward32c4a8a2000-03-06 03:40:29 +0000347 if output_dir is not None:
348 output_filename = os.path.join (output_dir, output_filename)
Greg Warddbd12761999-08-29 18:15:07 +0000349
Greg Ward32c4a8a2000-03-06 03:40:29 +0000350 if self._need_link (objects, output_filename):
351
352 if debug:
353 ldflags = self.ldflags_shared_debug
Greg Ward32c4a8a2000-03-06 03:40:29 +0000354 else:
355 ldflags = self.ldflags_shared
356
Greg Ward5299b6a2000-05-20 13:23:21 +0000357 export_opts = []
358 for sym in (export_symbols or []):
359 export_opts.append("/EXPORT:" + sym)
360
361 ld_args = (ldflags + lib_opts + export_opts +
362 objects + ['/OUT:' + output_filename])
Greg Ward32c4a8a2000-03-06 03:40:29 +0000363
364 if extra_preargs:
365 ld_args[:0] = extra_preargs
366 if extra_postargs:
367 ld_args.extend (extra_postargs)
368
Greg Ward02a1a2b2000-04-15 22:15:07 +0000369 print "link_shared_object():"
370 print " output_filename =", output_filename
371 print " mkpath'ing:", os.path.dirname (output_filename)
Greg Ward32c4a8a2000-03-06 03:40:29 +0000372 self.mkpath (os.path.dirname (output_filename))
373 self.spawn ([self.link] + ld_args)
374
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000375 else:
Greg Ward32c4a8a2000-03-06 03:40:29 +0000376 self.announce ("skipping %s (up-to-date)" % output_filename)
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000377
Greg Ward32c4a8a2000-03-06 03:40:29 +0000378 # link_shared_object ()
Greg Wardf70c6032000-04-19 02:16:49 +0000379
380
381 def link_executable (self,
382 objects,
383 output_progname,
384 output_dir=None,
385 libraries=None,
386 library_dirs=None,
387 runtime_library_dirs=None,
388 debug=0,
389 extra_preargs=None,
390 extra_postargs=None):
391
392 (objects, output_dir) = self._fix_object_args (objects, output_dir)
393 (libraries, library_dirs, runtime_library_dirs) = \
394 self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
395
396 if runtime_library_dirs:
397 self.warn ("I don't know what to do with 'runtime_library_dirs': "
398 + str (runtime_library_dirs))
399
400 lib_opts = gen_lib_options (self,
401 library_dirs, runtime_library_dirs,
402 libraries)
403 output_filename = output_progname + self.exe_extension
404 if output_dir is not None:
405 output_filename = os.path.join (output_dir, output_filename)
406
407 if self._need_link (objects, output_filename):
408
409 if debug:
410 ldflags = self.ldflags_shared_debug[1:]
411 else:
412 ldflags = self.ldflags_shared[1:]
413
414 ld_args = ldflags + lib_opts + \
415 objects + ['/OUT:' + output_filename]
416
417 if extra_preargs:
418 ld_args[:0] = extra_preargs
419 if extra_postargs:
420 ld_args.extend (extra_postargs)
421
422 self.mkpath (os.path.dirname (output_filename))
423 self.spawn ([self.link] + ld_args)
424 else:
425 self.announce ("skipping %s (up-to-date)" % output_filename)
Greg Ward32c4a8a2000-03-06 03:40:29 +0000426
Greg Ward4ba9b2e2000-02-10 02:15:52 +0000427
Greg Ward32c4a8a2000-03-06 03:40:29 +0000428 # -- Miscellaneous methods -----------------------------------------
429 # These are all used by the 'gen_lib_options() function, in
430 # ccompiler.py.
Greg Wardc74138d1999-10-03 20:47:52 +0000431
432 def library_dir_option (self, dir):
433 return "/LIBPATH:" + dir
434
Greg Wardd03f88a2000-03-18 15:19:51 +0000435 def runtime_library_dir_option (self, dir):
436 raise DistutilsPlatformError, \
437 "don't know how to set runtime library search path for MSVC++"
438
Greg Wardc74138d1999-10-03 20:47:52 +0000439 def library_option (self, lib):
440 return self.library_filename (lib)
441
442
443 def find_library_file (self, dirs, lib):
444
445 for dir in dirs:
446 libfile = os.path.join (dir, self.library_filename (lib))
447 if os.path.exists (libfile):
448 return libfile
449
450 else:
451 # Oops, didn't find it in *any* of 'dirs'
452 return None
453
454 # find_library_file ()
455
Greg Warddbd12761999-08-29 18:15:07 +0000456# class MSVCCompiler