mirror of https://gitlab.com/ita1024/waf.git
Sort visual studio versions by version number #2352
This commit is contained in:
parent
b91ef6a91b
commit
2a1eeba691
|
@ -9,7 +9,7 @@ def configure(ctx):
|
||||||
def test(ctx):
|
def test(ctx):
|
||||||
errors = []
|
errors = []
|
||||||
msvc_versions = ['wsdk 6.1', 'winphone 8.0', 'msvc 9.0', 'msvc 16.6', 'msvc 16.0', 'msvc 15.9', 'msvc 15.0', 'msvc 14.0', 'msvc 12.0', 'msvc 11.0']
|
msvc_versions = ['wsdk 6.1', 'winphone 8.0', 'msvc 9.0', 'msvc 16.6', 'msvc 16.0', 'msvc 15.9', 'msvc 15.0', 'msvc 14.0', 'msvc 12.0', 'msvc 11.0']
|
||||||
sorted_versions = ['wsdk 6.1', 'winphone 8.0', 'msvc 16.6', 'msvc 16.0', 'msvc 15.9', 'msvc 15.0', 'msvc 14.0', 'msvc 12.0', 'msvc 11.0', 'msvc 9.0']
|
sorted_versions = ['msvc 16.6', 'msvc 16.0', 'msvc 15.9', 'msvc 15.0', 'msvc 14.0', 'msvc 12.0', 'msvc 11.0', 'msvc 9.0', 'winphone 8.0', 'wsdk 6.1']
|
||||||
|
|
||||||
def tt(msg, result, expected):
|
def tt(msg, result, expected):
|
||||||
color = 'RED'
|
color = 'RED'
|
||||||
|
|
|
@ -103,15 +103,20 @@ def options(opt):
|
||||||
opt.add_option('--msvc_targets', type='string', help = 'msvc targets, eg: "x64,arm"', default='')
|
opt.add_option('--msvc_targets', type='string', help = 'msvc targets, eg: "x64,arm"', default='')
|
||||||
opt.add_option('--no-msvc-lazy', action='store_false', help = 'lazily check msvc target environments', default=True, dest='msvc_lazy')
|
opt.add_option('--no-msvc-lazy', action='store_false', help = 'lazily check msvc target environments', default=True, dest='msvc_lazy')
|
||||||
|
|
||||||
class MSVCVersion:
|
class MSVCVersion(object):
|
||||||
def __init__(self, ver):
|
def __init__(self, ver):
|
||||||
x = ver.split()
|
m = re.search('^(.*)\s+(\d+[.]\d+)', ver)
|
||||||
self.a = x[0]
|
if m:
|
||||||
self.b = float(x[1])
|
self.name = m.group(1)
|
||||||
|
self.number = float(m.group(2))
|
||||||
|
else:
|
||||||
|
self.name = ver
|
||||||
|
self.number = 0.
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if self.a == other.a: return self.b < other.b
|
if self.number == other.number:
|
||||||
return self.a < other.a
|
return self.name < other.name
|
||||||
|
return self.number < other.number
|
||||||
|
|
||||||
@conf
|
@conf
|
||||||
def setup_msvc(conf, versiondict):
|
def setup_msvc(conf, versiondict):
|
||||||
|
@ -129,8 +134,6 @@ def setup_msvc(conf, versiondict):
|
||||||
platforms=Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_msvc_platforms + all_icl_platforms]
|
platforms=Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_msvc_platforms + all_icl_platforms]
|
||||||
desired_versions = getattr(Options.options, 'msvc_version', '').split(',')
|
desired_versions = getattr(Options.options, 'msvc_version', '').split(',')
|
||||||
if desired_versions == ['']:
|
if desired_versions == ['']:
|
||||||
def versionkey(x):
|
|
||||||
return float(x.split()[1])
|
|
||||||
desired_versions = conf.env.MSVC_VERSIONS or list(sorted(versiondict.keys(), key=MSVCVersion, reverse=True))
|
desired_versions = conf.env.MSVC_VERSIONS or list(sorted(versiondict.keys(), key=MSVCVersion, reverse=True))
|
||||||
|
|
||||||
# Override lazy detection by evaluating after the fact.
|
# Override lazy detection by evaluating after the fact.
|
||||||
|
|
Loading…
Reference in New Issue