@@ -170,6 +170,28 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
170
170
self .spawn (["windres" , "-i" , src , "-o" , obj ])
171
171
except DistutilsExecError as msg :
172
172
raise CompileError (msg )
173
+ elif ext == '.mc' :
174
+ # Adapted from msvc9compiler:
175
+ #
176
+ # Compile .MC to .RC file to .RES file.
177
+ # * '-h dir' specifies the directory for the generated include file
178
+ # * '-r dir' specifies the target directory of the generated RC file and the binary message resource it includes
179
+ #
180
+ # For now (since there are no options to change this),
181
+ # we use the source-directory for the include file and
182
+ # the build directory for the RC file and message
183
+ # resources. This works at least for win32all.
184
+ h_dir = os .path .dirname (src )
185
+ rc_dir = os .path .dirname (obj )
186
+ try :
187
+ # first compile .MC to .RC and .H file
188
+ self .spawn (['windmc' ] + ['-h' , h_dir , '-r' , rc_dir ] + [src ])
189
+ base , _ = os .path .splitext (os .path .basename (src ))
190
+ rc_file = os .path .join (rc_dir , base + '.rc' )
191
+ # then compile .RC to .RES file
192
+ self .spawn (['windres' , '-i' , rc_file , '-o' , obj ])
193
+ except DistutilsExecError as msg :
194
+ raise CompileError (msg )
173
195
else : # for other files use the C-compiler
174
196
try :
175
197
self .spawn (self .compiler_so + cc_args + [src , '-o' , obj ] +
@@ -264,9 +286,9 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
264
286
base , ext = os .path .splitext (src_name )
265
287
# use 'normcase' only for resource suffixes
266
288
ext_normcase = os .path .normcase (ext )
267
- if ext_normcase in ['.rc' ,'.res' ]:
289
+ if ext_normcase in ['.rc' , '.res' , '.mc ' ]:
268
290
ext = ext_normcase
269
- if ext not in (self .src_extensions + ['.rc' ,'.res' ]):
291
+ if ext not in (self .src_extensions + ['.rc' , '.res' , '.mc ' ]):
270
292
raise UnknownFileError ("unknown file type '%s' (from '%s')" % \
271
293
(ext , src_name ))
272
294
base = os .path .splitdrive (base )[1 ] # Chop off the drive
0 commit comments