mirror of https://gitlab.com/ita1024/waf.git
Added support for Windows Phone 8 compilers; added feature support for Windows Desktop Application and Windows Phone Application compilation
This commit is contained in:
parent
582a1a59f1
commit
46f51a3925
|
@ -35,8 +35,9 @@ Supported platforms: ia64, x64, x86, x86_amd64, x86_ia64
|
|||
Compilers supported:
|
||||
|
||||
* msvc => Visual Studio, versions 6.0 (VC 98, VC .NET 2002) to 11.0 (Visual Studio 2012)
|
||||
* wsdk => Windows SDK, versions 6.0, 6.1, 7.0, 7.1
|
||||
* wsdk => Windows SDK, versions 6.0, 6.1, 7.0, 7.1, 8.0
|
||||
* icl => Intel compiler, versions 9, 10, 11, 13
|
||||
* winphone => Visual Studio to target Windows Phone 8 native (version 8.0 for now)
|
||||
* Smartphone => Compiler/SDK for Smartphone devices (armv4/v4i)
|
||||
* PocketPC => Compiler/SDK for PocketPC devices (armv4/v4i)
|
||||
|
||||
|
@ -48,7 +49,7 @@ Setting PYTHONUNBUFFERED gives the unbuffered output.
|
|||
"""
|
||||
|
||||
import os, sys, re, tempfile
|
||||
from waflib import Utils, Task, Logs, Options
|
||||
from waflib import Utils, Task, Logs, Options, Errors
|
||||
from waflib.Logs import debug, warn
|
||||
from waflib.TaskGen import after_method, feature
|
||||
|
||||
|
@ -77,7 +78,7 @@ wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xol
|
|||
'''.split()
|
||||
"""importlibs provided by MSVC/Platform SDK. Do NOT search them"""
|
||||
|
||||
all_msvc_platforms = [ ('x64', 'amd64'), ('x86', 'x86'), ('ia64', 'ia64'), ('x86_amd64', 'amd64'), ('x86_ia64', 'ia64') ]
|
||||
all_msvc_platforms = [ ('x64', 'amd64'), ('x86', 'x86'), ('ia64', 'ia64'), ('x86_amd64', 'amd64'), ('x86_ia64', 'ia64'), ('x86_arm', 'arm') ]
|
||||
"""List of msvc platforms"""
|
||||
|
||||
all_wince_platforms = [ ('armv4', 'arm'), ('armv4i', 'arm'), ('mipsii', 'mips'), ('mipsii_fp', 'mips'), ('mipsiv', 'mips'), ('mipsiv_fp', 'mips'), ('sh4', 'sh'), ('x86', 'cex86') ]
|
||||
|
@ -134,7 +135,7 @@ set LIB=
|
|||
call "%s" %s
|
||||
echo PATH=%%PATH%%
|
||||
echo INCLUDE=%%INCLUDE%%
|
||||
echo LIB=%%LIB%%
|
||||
echo LIB=%%LIB%%;%%LIBPATH%%
|
||||
""" % (vcvars,target))
|
||||
sout = conf.cmd_and_log(['cmd', '/E:on', '/V:on', '/C', batfile.abspath()])
|
||||
lines = sout.splitlines()
|
||||
|
@ -142,20 +143,6 @@ echo LIB=%%LIB%%
|
|||
if not lines[0]:
|
||||
lines.pop(0)
|
||||
|
||||
if version == '11.0':
|
||||
if lines[0].startswith('Error'):
|
||||
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_1)')
|
||||
else:
|
||||
for x in ('Setting environment', 'Setting SDK environment', 'Intel(R) C++ Compiler',
|
||||
'Intel Parallel Studio', 'Intel(R) Parallel Studio', 'Intel(R) Composer',
|
||||
'Intel Corporation. All rights reserved.'):
|
||||
if lines[0].find(x) > -1:
|
||||
lines.pop(0)
|
||||
break
|
||||
else:
|
||||
debug('msvc: get_msvc_version: %r %r %r -> not found', compiler, version, target)
|
||||
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_2)')
|
||||
|
||||
MSVC_PATH = MSVC_INCDIR = MSVC_LIBDIR = None
|
||||
for line in lines:
|
||||
if line.startswith('PATH='):
|
||||
|
@ -165,7 +152,6 @@ echo LIB=%%LIB%%
|
|||
MSVC_INCDIR = [i for i in line[8:].split(';') if i]
|
||||
elif line.startswith('LIB='):
|
||||
MSVC_LIBDIR = [i for i in line[4:].split(';') if i]
|
||||
|
||||
if None in (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR):
|
||||
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_3)')
|
||||
|
||||
|
@ -334,7 +320,8 @@ def gather_msvc_targets(conf, versions, version, vc_path):
|
|||
targets.append(('x86', ('x86', conf.get_msvc_version('msvc', version, '', os.path.join(vc_path, 'Bin', 'vcvars32.bat')))))
|
||||
except conf.errors.ConfigurationError:
|
||||
pass
|
||||
versions.append(('msvc '+ version, targets))
|
||||
if targets:
|
||||
versions.append(('msvc '+ version, targets))
|
||||
|
||||
@conf
|
||||
def gather_wince_targets(conf, versions, version, vc_path, vsvars, supported_platforms):
|
||||
|
@ -357,6 +344,18 @@ def gather_wince_targets(conf, versions, version, vc_path, vsvars, supported_pla
|
|||
if cetargets:
|
||||
versions.append((device + ' ' + version, cetargets))
|
||||
|
||||
@conf
|
||||
def gather_winphone_targets(conf, versions, version, vc_path, vsvars):
|
||||
#Looking for WinPhone compilers
|
||||
targets = []
|
||||
for target,realtarget in all_msvc_platforms[::-1]:
|
||||
try:
|
||||
targets.append((target, (realtarget, conf.get_msvc_version('winphone', version, target, vsvars))))
|
||||
except conf.errors.ConfigurationError as e:
|
||||
pass
|
||||
if targets:
|
||||
versions.append(('winphone '+ version, targets))
|
||||
|
||||
@conf
|
||||
def gather_msvc_versions(conf, versions):
|
||||
vc_paths = []
|
||||
|
@ -379,6 +378,10 @@ def gather_msvc_versions(conf, versions):
|
|||
if wince_supported_platforms and os.path.isfile(vsvars):
|
||||
conf.gather_wince_targets(versions, version, vc_path, vsvars, wince_supported_platforms)
|
||||
|
||||
vsvars = os.path.join(vs_path, 'VC', 'WPSDK', 'WP80', 'vcvarsphoneall.bat')
|
||||
if os.path.isfile(vsvars):
|
||||
conf.gather_winphone_targets(versions, '8.0', vc_path, vsvars)
|
||||
|
||||
for version,vc_path in vc_paths:
|
||||
vs_path = os.path.dirname(vc_path)
|
||||
conf.gather_msvc_targets(versions, version, vc_path)
|
||||
|
@ -755,9 +758,9 @@ def find_msvc(conf):
|
|||
conf.find_program('MT', path_list=path, var='MT')
|
||||
v['MTFLAGS'] = ['/NOLOGO']
|
||||
|
||||
conf.load('winres')
|
||||
|
||||
if not conf.env['WINRC']:
|
||||
try:
|
||||
conf.load('winres')
|
||||
except Errors.WafError:
|
||||
warn('Resource compiler not found. Compiling resource file is disabled')
|
||||
|
||||
@conf
|
||||
|
@ -1032,3 +1035,25 @@ def wrap_class(class_name):
|
|||
for k in 'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split():
|
||||
wrap_class(k)
|
||||
|
||||
def make_winapp(self, family):
|
||||
append = self.env.append_unique
|
||||
append('DEFINES', 'WINAPI_FAMILY=%s' % family)
|
||||
append('CXXFLAGS', '/ZW')
|
||||
append('CXXFLAGS', '/TP')
|
||||
for lib_path in self.env.LIBPATH:
|
||||
append('CXXFLAGS','/AI%s'%lib_path)
|
||||
|
||||
@feature('winphoneapp')
|
||||
@after_method('process_use')
|
||||
@after_method('propagate_uselib_vars')
|
||||
def make_winphone_app(self):
|
||||
make_winapp(self, 'WINAPI_FAMILY_PHONE_APP')
|
||||
conf.env.append_unique('LINKFLAGS', '/NODEFAULTLIB:ole32.lib')
|
||||
conf.env.append_unique('LINKFLAGS', 'PhoneAppModelHost.lib')
|
||||
|
||||
|
||||
@feature('winapp')
|
||||
@after_method('process_use')
|
||||
@after_method('propagate_uselib_vars')
|
||||
def make_windows_app(self):
|
||||
make_winapp(self, 'WINAPI_FAMILY_DESKTOP_APP')
|
||||
|
|
Loading…
Reference in New Issue