3
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
5
import os,sys,re,tempfile
10
import winreg as _winreg
13
from waflib import Utils,TaskGen,Runner,Configure,Task,Options
14
from waflib.Logs import debug,info,warn,error
15
from waflib.TaskGen import after_method,before_method,feature
16
from waflib.Configure import conf
17
from waflib.Tools import ccroot,c,cxx,ar,winres
19
aclui activeds ad1 adptif adsiid advapi32 asycfilt authz bhsupp bits bufferoverflowu cabinet
20
cap certadm certidl ciuuid clusapi comctl32 comdlg32 comsupp comsuppd comsuppw comsuppwd comsvcs
21
credui crypt32 cryptnet cryptui d3d8thk daouuid dbgeng dbghelp dciman32 ddao35 ddao35d
22
ddao35u ddao35ud delayimp dhcpcsvc dhcpsapi dlcapi dnsapi dsprop dsuiext dtchelp
23
faultrep fcachdll fci fdi framedyd framedyn gdi32 gdiplus glauxglu32 gpedit gpmuuid
24
gtrts32w gtrtst32hlink htmlhelp httpapi icm32 icmui imagehlp imm32 iphlpapi iprop
25
kernel32 ksguid ksproxy ksuser libcmt libcmtd libcpmt libcpmtd loadperf lz32 mapi
26
mapi32 mgmtapi minidump mmc mobsync mpr mprapi mqoa mqrt msacm32 mscms mscoree
27
msdasc msimg32 msrating mstask msvcmrt msvcurt msvcurtd mswsock msxml2 mtx mtxdm
28
netapi32 nmapinmsupp npptools ntdsapi ntdsbcli ntmsapi ntquery odbc32 odbcbcp
29
odbccp32 oldnames ole32 oleacc oleaut32 oledb oledlgolepro32 opends60 opengl32
30
osptk parser pdh penter pgobootrun pgort powrprof psapi ptrustm ptrustmd ptrustu
31
ptrustud qosname rasapi32 rasdlg rassapi resutils riched20 rpcndr rpcns4 rpcrt4 rtm
32
rtutils runtmchk scarddlg scrnsave scrnsavw secur32 sensapi setupapi sfc shell32
33
shfolder shlwapi sisbkup snmpapi sporder srclient sti strsafe svcguid tapi32 thunk32
34
traffic unicows url urlmon user32 userenv usp10 uuid uxtheme vcomp vcompd vdmdbg
35
version vfw32 wbemuuid webpost wiaguid wininet winmm winscard winspool winstrm
36
wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xolehlp
38
all_msvc_platforms=[('x64','amd64'),('x86','x86'),('ia64','ia64'),('x86_amd64','amd64'),('x86_ia64','ia64')]
39
all_wince_platforms=[('armv4','arm'),('armv4i','arm'),('mipsii','mips'),('mipsii_fp','mips'),('mipsiv','mips'),('mipsiv_fp','mips'),('sh4','sh'),('x86','cex86')]
40
all_icl_platforms=[('intel64','amd64'),('em64t','amd64'),('ia32','x86'),('Itanium','ia64')]
42
opt.add_option('--msvc_version',type='string',help='msvc version, eg: "msvc 10.0,msvc 9.0"',default='')
43
opt.add_option('--msvc_targets',type='string',help='msvc targets, eg: "x64,arm"',default='')
44
def setup_msvc(conf,versions):
45
platforms=getattr(Options.options,'msvc_targets','').split(',')
47
platforms=Utils.to_list(conf.env['MSVC_TARGETS'])or[i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms]
48
desired_versions=getattr(Options.options,'msvc_version','').split(',')
49
if desired_versions==['']:
50
desired_versions=conf.env['MSVC_VERSIONS']or[v for v,_ in versions][::-1]
51
versiondict=dict(versions)
52
for version in desired_versions:
54
targets=dict(versiondict[version])
55
for target in platforms:
57
arch,(p1,p2,p3)=targets[target]
58
compiler,revision=version.rsplit(' ',1)
59
return compiler,revision,p1,p2,p3
60
except KeyError:continue
61
except KeyError:continue
62
conf.fatal('msvc: Impossible to find a valid architecture for building (in setup_msvc)')
63
def get_msvc_version(conf,compiler,version,target,vcvars):
64
debug('msvc: get_msvc_version: %r %r %r',compiler,version,target)
65
batfile=conf.bldnode.make_node('waf-print-msvc.bat')
66
batfile.write("""@echo off
71
echo INCLUDE=%%INCLUDE%%
74
sout=conf.cmd_and_log(['cmd','/E:on','/V:on','/C',batfile.abspath()])
75
lines=sout.splitlines()
76
if not lines[0]:lines=lines[1:]
77
for x in('Setting environment','Setting SDK environment','Intel(R) C++ Compiler','Intel Parallel Studio'):
78
if lines[0].find(x)!=-1:
81
debug('msvc: get_msvc_version: %r %r %r -> not found',compiler,version,target)
82
conf.fatal('msvc: Impossible to find a valid architecture for building (in get_msvc_version)')
83
for line in lines[1:]:
84
if line.startswith('PATH='):
86
MSVC_PATH=path.split(';')
87
elif line.startswith('INCLUDE='):
88
MSVC_INCDIR=[i for i in line[8:].split(';')if i]
89
elif line.startswith('LIB='):
90
MSVC_LIBDIR=[i for i in line[4:].split(';')if i]
92
env.update(os.environ)
94
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
95
cxx=conf.find_program(compiler_name,path_list=MSVC_PATH)
96
cxx=conf.cmd_to_list(cxx)
101
conf.cmd_and_log(cxx+['/help'],env=env)
103
debug('msvc: get_msvc_version: %r %r %r -> failure'%(compiler,version,target))
105
conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
107
debug('msvc: get_msvc_version: %r %r %r -> OK',compiler,version,target)
109
conf.env[compiler_name]=''
110
return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR)
111
def gather_wsdk_versions(conf,versions):
112
version_pattern=re.compile('^v..?.?\...?.?')
114
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
117
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows')
123
version=_winreg.EnumKey(all_versions,index)
127
if not version_pattern.match(version):
130
msvc_version=_winreg.OpenKey(all_versions,version)
131
path,type=_winreg.QueryValueEx(msvc_version,'InstallationFolder')
134
if os.path.isfile(os.path.join(path,'bin','SetEnv.cmd')):
136
for target,arch in all_msvc_platforms:
138
targets.append((target,(arch,conf.get_msvc_version('wsdk',version,'/'+target,os.path.join(path,'bin','SetEnv.cmd')))))
139
except conf.errors.ConfigurationError:
141
versions.append(('wsdk '+version[1:],targets))
142
def gather_wince_supported_platforms():
143
supported_wince_platforms=[]
145
ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs')
148
ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs')
152
return supported_wince_platforms
156
sdk_device=_winreg.EnumKey(ce_sdk,ce_index)
160
sdk=_winreg.OpenKey(ce_sdk,sdk_device)
162
path,type=_winreg.QueryValueEx(sdk,'SDKRootDir')
165
path,type=_winreg.QueryValueEx(sdk,'SDKInformation')
166
path,xml=os.path.split(path)
170
path,device=os.path.split(path)
172
path,device=os.path.split(path)
173
for arch,compiler in all_wince_platforms:
175
if os.path.isdir(os.path.join(path,device,'Lib',arch)):
176
platforms.append((arch,compiler,os.path.join(path,device,'Include',arch),os.path.join(path,device,'Lib',arch)))
178
supported_wince_platforms.append((device,platforms))
179
return supported_wince_platforms
180
def gather_msvc_detected_versions():
181
version_pattern=re.compile('^(\d\d?\.\d\d?)(Exp)?$')
183
for vcver,vcvar in[('VCExpress','Exp'),('VisualStudio','')]:
185
prefix='SOFTWARE\\Wow6432node\\Microsoft\\'+vcver
186
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix)
189
prefix='SOFTWARE\\Microsoft\\'+vcver
190
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix)
196
version=_winreg.EnumKey(all_versions,index)
200
match=version_pattern.match(version)
204
versionnumber=float(match.group(1))
205
detected_versions.append((versionnumber,version+vcvar,prefix+"\\"+version))
209
detected_versions.sort(key=fun)
211
detected_versions.sort(lambda x,y:cmp(x[0],y[0]))
212
return detected_versions
213
def gather_msvc_targets(conf,versions,version,vc_path):
215
if os.path.isfile(os.path.join(vc_path,'vcvarsall.bat')):
216
for target,realtarget in all_msvc_platforms[::-1]:
218
targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(vc_path,'vcvarsall.bat')))))
219
except conf.errors.ConfigurationError:
221
elif os.path.isfile(os.path.join(vc_path,'Common7','Tools','vsvars32.bat')):
223
targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(vc_path,'Common7','Tools','vsvars32.bat')))))
224
except conf.errors.ConfigurationError:
226
elif os.path.isfile(os.path.join(vc_path,'Bin','vcvars32.bat')):
228
targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'',os.path.join(vc_path,'Bin','vcvars32.bat')))))
229
except conf.errors.ConfigurationError:
231
versions.append(('msvc '+version,targets))
232
def gather_wince_targets(conf,versions,version,vc_path,vsvars,supported_platforms):
233
for device,platforms in supported_platforms:
235
for platform,compiler,include,lib in platforms:
236
winCEpath=os.path.join(vc_path,'ce')
237
if not os.path.isdir(winCEpath):
240
common_bindirs,_1,_2=conf.get_msvc_version('msvc',version,'x86',vsvars)
241
except conf.errors.ConfigurationError:
243
if os.path.isdir(os.path.join(winCEpath,'lib',platform)):
244
bindirs=[os.path.join(winCEpath,'bin',compiler),os.path.join(winCEpath,'bin','x86_'+compiler)]+common_bindirs
245
incdirs=[os.path.join(winCEpath,'include'),os.path.join(winCEpath,'atlmfc','include'),include]
246
libdirs=[os.path.join(winCEpath,'lib',platform),os.path.join(winCEpath,'atlmfc','lib',platform),lib]
247
cetargets.append((platform,(platform,(bindirs,incdirs,libdirs))))
249
versions.append((device+' '+version,cetargets))
250
def gather_msvc_versions(conf,versions):
252
for(v,version,reg)in gather_msvc_detected_versions():
255
msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\VC")
257
msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\Microsoft Visual C++")
258
path,type=_winreg.QueryValueEx(msvc_version,'ProductDir')
259
vc_paths.append((version,os.path.abspath(str(path))))
262
wince_supported_platforms=gather_wince_supported_platforms()
263
for version,vc_path in vc_paths:
264
vs_path=os.path.dirname(vc_path)
265
vsvars=os.path.join(vs_path,'Common7','Tools','vsvars32.bat')
266
if wince_supported_platforms and os.path.isfile(vsvars):
267
conf.gather_wince_targets(versions,version,vc_path,vsvars,wince_supported_platforms)
268
for version,vc_path in vc_paths:
269
vs_path=os.path.dirname(vc_path)
270
conf.gather_msvc_targets(versions,version,vc_path)
271
def gather_icl_versions(conf,versions):
272
version_pattern=re.compile('^...?.?\....?.?')
274
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
277
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Compilers\\C++')
283
version=_winreg.EnumKey(all_versions,index)
287
if not version_pattern.match(version):
290
for target,arch in all_icl_platforms:
292
if target=='intel64':targetDir='EM64T_NATIVE'
293
else:targetDir=target
294
_winreg.OpenKey(all_versions,version+'\\'+targetDir)
295
icl_version=_winreg.OpenKey(all_versions,version)
296
path,type=_winreg.QueryValueEx(icl_version,'ProductDir')
297
if os.path.isfile(os.path.join(path,'bin','iclvars.bat')):
299
targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat')))))
300
except conf.errors.ConfigurationError:
304
for target,arch in all_icl_platforms:
306
icl_version=_winreg.OpenKey(all_versions,version+'\\'+target)
307
path,type=_winreg.QueryValueEx(icl_version,'ProductDir')
308
if os.path.isfile(os.path.join(path,'bin','iclvars.bat')):
310
targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat')))))
311
except conf.errors.ConfigurationError:
316
versions.append(('intel '+major,targets))
317
def get_msvc_versions(conf):
318
if not conf.env['MSVC_INSTALLED_VERSIONS']:
320
conf.gather_icl_versions(lst)
321
conf.gather_wsdk_versions(lst)
322
conf.gather_msvc_versions(lst)
323
conf.env['MSVC_INSTALLED_VERSIONS']=lst
324
return conf.env['MSVC_INSTALLED_VERSIONS']
325
def print_all_msvc_detected(conf):
326
for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
328
for target,l in targets:
330
def detect_msvc(conf):
331
versions=get_msvc_versions(conf)
332
return setup_msvc(conf,versions)
333
def find_lt_names_msvc(self,libname,is_static=False):
334
lt_names=['lib%s.la'%libname,'%s.la'%libname,]
335
for path in self.env['LIBPATH']:
337
laf=os.path.join(path,la)
339
if os.path.exists(laf):
340
ltdict=Utils.read_la_file(laf)
342
if ltdict.get('libdir',''):
343
lt_libdir=ltdict['libdir']
344
if not is_static and ltdict.get('library_names',''):
345
dllnames=ltdict['library_names'].split()
346
dll=dllnames[0].lower()
347
dll=re.sub('\.dll$','',dll)
348
return(lt_libdir,dll,False)
349
elif ltdict.get('old_library',''):
350
olib=ltdict['old_library']
351
if os.path.exists(os.path.join(path,olib)):
352
return(path,olib,True)
353
elif lt_libdir!=''and os.path.exists(os.path.join(lt_libdir,olib)):
354
return(lt_libdir,olib,True)
356
return(None,olib,True)
358
raise self.errors.WafError('invalid libtool object file: %s'%laf)
359
return(None,None,None)
360
def libname_msvc(self,libname,is_static=False):
362
lib=re.sub('\.lib$','',lib)
363
if lib in g_msvc_systemlibs:
365
lib=re.sub('^lib','',lib)
368
(lt_path,lt_libname,lt_static)=self.find_lt_names_msvc(lib,is_static)
369
if lt_path!=None and lt_libname!=None:
371
return os.path.join(lt_path,lt_libname)
373
_libpaths=[lt_path]+self.env['LIBPATH']
375
_libpaths=self.env['LIBPATH']
376
static_libs=['lib%ss.lib'%lib,'lib%s.lib'%lib,'%ss.lib'%lib,'%s.lib'%lib,]
377
dynamic_libs=['lib%s.dll.lib'%lib,'lib%s.dll.a'%lib,'%s.dll.lib'%lib,'%s.dll.a'%lib,'lib%s_d.lib'%lib,'%s_d.lib'%lib,'%s.lib'%lib,]
380
libnames=dynamic_libs+static_libs
381
for path in _libpaths:
382
for libn in libnames:
383
if os.path.exists(os.path.join(path,libn)):
384
debug('msvc: lib found: %s'%os.path.join(path,libn))
385
return re.sub('\.lib$','',libn)
386
self.fatal("The library %r could not be found"%libname)
387
return re.sub('\.lib$','',libname)
388
def check_lib_msvc(self,libname,is_static=False,uselib_store=None):
389
libn=self.libname_msvc(libname,is_static)
391
uselib_store=libname.upper()
392
if False and is_static:
393
self.env['STLIB_'+uselib_store]=[libn]
395
self.env['LIB_'+uselib_store]=[libn]
396
def check_libs_msvc(self,libnames,is_static=False):
397
for libname in Utils.to_list(libnames):
398
self.check_lib_msvc(libname,is_static)
402
conf.msvc_common_flags()
404
conf.cxx_load_tools()
407
conf.link_add_flags()
408
conf.visual_studio_add_flags()
409
def no_autodetect(conf):
410
conf.env.NO_MSVC_DETECT=1
412
def autodetect(conf):
416
compiler,version,path,includes,libdirs=conf.detect_msvc()
418
v['INCLUDES']=includes
420
v['MSVC_COMPILER']=compiler
422
v['MSVC_VERSION']=float(version)
424
v['MSVC_VERSION']=float(version[:-3])
425
def _get_prog_names(conf,compiler):
426
if compiler=='intel':
434
return compiler_name,linker_name,lib_name
436
if sys.platform=='cygwin':
437
conf.fatal('MSVC module does not work under cygwin Python!')
440
compiler=v['MSVC_COMPILER']
441
version=v['MSVC_VERSION']
442
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
443
v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11)
445
if v['CXX']:cxx=v['CXX']
446
elif'CXX'in conf.environ:cxx=conf.environ['CXX']
447
cxx=conf.find_program(compiler_name,var='CXX',path_list=path)
448
cxx=conf.cmd_to_list(cxx)
449
env=dict(conf.environ)
450
if path:env.update(PATH=';'.join(path))
451
if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env):
452
conf.fatal('the msvc compiler could not be identified')
454
v['CC_NAME']=v['CXX_NAME']='msvc'
455
if not v['LINK_CXX']:
456
link=conf.find_program(linker_name,path_list=path)
457
if link:v['LINK_CXX']=link
458
else:conf.fatal('%s was not found (linker)'%linker_name)
461
v['LINK_CC']=v['LINK_CXX']
463
stliblink=conf.find_program(lib_name,path_list=path,var='AR')
464
if not stliblink:return
465
v['ARFLAGS']=['/NOLOGO']
467
mt=conf.find_program('MT',path_list=path,var='MT')
468
v['MTFLAGS']=['/NOLOGO']
470
if not conf.env['WINRC']:
471
warn('Resource compiler not found. Compiling resource file is disabled')
472
def visual_studio_add_flags(self):
474
try:v.prepend_value('INCLUDES',self.environ['INCLUDE'].split(';'))
476
try:v.prepend_value('LIBPATH',self.environ['LIB'].split(';'))
478
def msvc_common_flags(conf):
480
v['DEST_BINFMT']='pe'
481
v.append_value('CFLAGS',['/nologo'])
482
v.append_value('CXXFLAGS',['/nologo'])
483
v['DEFINES_ST']='/D%s'
485
v['CC_TGT_F']=['/c','/Fo']
486
if v['MSVC_VERSION']>=8:
487
v['CC_TGT_F']=['/FC']+v['CC_TGT_F']
489
v['CXX_TGT_F']=['/c','/Fo']
490
if v['MSVC_VERSION']>=8:
491
v['CXX_TGT_F']=['/FC']+v['CXX_TGT_F']
492
v['CPPPATH_ST']='/I%s'
493
v['AR_TGT_F']=v['CCLNK_TGT_F']=v['CXXLNK_TGT_F']='/OUT:'
494
v['CFLAGS_CONSOLE']=v['CXXFLAGS_CONSOLE']=['/SUBSYSTEM:CONSOLE']
495
v['CFLAGS_NATIVE']=v['CXXFLAGS_NATIVE']=['/SUBSYSTEM:NATIVE']
496
v['CFLAGS_POSIX']=v['CXXFLAGS_POSIX']=['/SUBSYSTEM:POSIX']
497
v['CFLAGS_WINDOWS']=v['CXXFLAGS_WINDOWS']=['/SUBSYSTEM:WINDOWS']
498
v['CFLAGS_WINDOWSCE']=v['CXXFLAGS_WINDOWSCE']=['/SUBSYSTEM:WINDOWSCE']
499
v['CFLAGS_CRT_MULTITHREADED']=v['CXXFLAGS_CRT_MULTITHREADED']=['/MT']
500
v['CFLAGS_CRT_MULTITHREADED_DLL']=v['CXXFLAGS_CRT_MULTITHREADED_DLL']=['/MD']
501
v['CFLAGS_CRT_MULTITHREADED_DBG']=v['CXXFLAGS_CRT_MULTITHREADED_DBG']=['/MTd']
502
v['CFLAGS_CRT_MULTITHREADED_DLL_DBG']=v['CXXFLAGS_CRT_MULTITHREADED_DLL_DBG']=['/MDd']
504
v['LIBPATH_ST']='/LIBPATH:%s'
505
v['STLIB_ST']='lib%s.lib'
506
v['STLIBPATH_ST']='/LIBPATH:%s'
507
v.append_value('LINKFLAGS',['/NOLOGO'])
508
if v['MSVC_MANIFEST']:
509
v.append_value('LINKFLAGS',['/MANIFEST'])
510
v['CFLAGS_cshlib']=[]
511
v['CXXFLAGS_cxxshlib']=[]
512
v['LINKFLAGS_cshlib']=v['LINKFLAGS_cxxshlib']=['/DLL']
513
v['cshlib_PATTERN']=v['cxxshlib_PATTERN']='%s.dll'
514
v['implib_PATTERN']='%s.lib'
515
v['IMPLIB_ST']='/IMPLIB:%s'
516
v['LINKFLAGS_cstlib']=[]
517
v['cstlib_PATTERN']=v['cxxstlib_PATTERN']='lib%s.lib'
518
v['cprogram_PATTERN']=v['cxxprogram_PATTERN']='%s.exe'
519
def apply_flags_msvc(self):
520
if self.env.CC_NAME!='msvc'or not getattr(self,'link_task',None):
522
is_static=isinstance(self.link_task,ccroot.stlink_task)
523
subsystem=getattr(self,'subsystem','')
525
subsystem='/subsystem:%s'%subsystem
526
flags=is_static and'ARFLAGS'or'LINKFLAGS'
527
self.env.append_value(flags,subsystem)
529
for f in self.env.LINKFLAGS:
532
pdbnode=self.link_task.outputs[0].change_ext('.pdb')
533
self.link_task.outputs.append(pdbnode)
535
self.install_task.source.append(pdbnode)
536
except AttributeError:
539
def apply_manifest(self):
540
if self.env.CC_NAME=='msvc'and self.env.MSVC_MANIFEST and getattr(self,'link_task',None):
541
out_node=self.link_task.outputs[0]
542
man_node=out_node.parent.find_or_declare(out_node.name+'.manifest')
543
self.link_task.outputs.append(man_node)
544
self.link_task.do_manifest=True
550
self.do_manifest=False
551
outfile=self.outputs[0].abspath()
553
for out_node in self.outputs:
554
if out_node.name.endswith('.manifest'):
555
manifest=out_node.abspath()
560
if'cprogram'in self.generator.features or'cxxprogram'in self.generator.features:
562
elif'cshlib'in self.generator.features or'cxxshlib'in self.generator.features:
564
debug('msvc: embedding manifest in mode %r'%mode)
566
lst.append(env['MT'])
567
lst.extend(Utils.to_list(env['MTFLAGS']))
568
lst.extend(['-manifest',manifest])
569
lst.append('-outputresource:%s;%s'%(outfile,mode))
571
return self.exec_command(*lst)
572
def quote_response_command(self,flag):
573
if flag.find(' ')>-1:
574
for x in('/LIBPATH:','/IMPLIB:','/OUT:','/I'):
575
if flag.startswith(x):
576
flag='%s"%s"'%(x,flag[len(x):])
581
def exec_response_command(self,cmd,**kw):
584
if sys.platform.startswith('win')and isinstance(cmd,list)and len(' '.join(cmd))>=8192:
586
cmd=[self.quote_response_command(x)for x in cmd]
587
(fd,tmp)=tempfile.mkstemp()
588
os.write(fd,'\r\n'.join(i.replace('\\','\\\\')for i in cmd[1:]))
590
cmd=[program,'@'+tmp]
591
ret=self.generator.bld.exec_command(cmd,**kw)
599
def exec_command_msvc(self,*k,**kw):
600
if self.env['CC_NAME']=='msvc':
601
if isinstance(k[0],list):
605
if a=='/Fo'or a=='/doc'or a[-1]==':':
613
env.update(PATH=';'.join(self.env['PATH']))
615
bld=self.generator.bld
617
if not kw.get('cwd',None):
619
except AttributeError:
620
bld.cwd=kw['cwd']=bld.variant_dir
621
ret=self.exec_response_command(k[0],**kw)
622
if not ret and getattr(self,'do_manifest',None):
625
for k in'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split():
626
cls=Task.classes.get(k,None)
628
cls.exec_command=exec_command_msvc
629
cls.exec_response_command=exec_response_command
630
cls.quote_response_command=quote_response_command
633
conf(get_msvc_version)
634
conf(gather_wsdk_versions)
635
conf(gather_msvc_targets)
636
conf(gather_wince_targets)
637
conf(gather_msvc_versions)
638
conf(gather_icl_versions)
639
conf(get_msvc_versions)
640
conf(print_all_msvc_detected)
642
conf(find_lt_names_msvc)
645
conf(check_libs_msvc)
649
conf(visual_studio_add_flags)
650
conf(msvc_common_flags)
651
after_method('apply_link')(apply_flags_msvc)
652
feature('c','cxx')(apply_flags_msvc)
653
feature('cprogram','cshlib','cxxprogram','cxxshlib')(apply_manifest)
654
after_method('apply_link')(apply_manifest)
b'\\ No newline at end of file'