mirror of
https://gitlab.com/ita1024/waf.git
synced 2025-01-03 06:57:31 +01:00
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):
|
||||
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']
|
||||
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):
|
||||
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('--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):
|
||||
x = ver.split()
|
||||
self.a = x[0]
|
||||
self.b = float(x[1])
|
||||
m = re.search('^(.*)\s+(\d+[.]\d+)', ver)
|
||||
if m:
|
||||
self.name = m.group(1)
|
||||
self.number = float(m.group(2))
|
||||
else:
|
||||
self.name = ver
|
||||
self.number = 0.
|
||||
|
||||
def __lt__(self, other):
|
||||
if self.a == other.a: return self.b < other.b
|
||||
return self.a < other.a
|
||||
if self.number == other.number:
|
||||
return self.name < other.name
|
||||
return self.number < other.number
|
||||
|
||||
@conf
|
||||
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]
|
||||
desired_versions = getattr(Options.options, 'msvc_version', '').split(',')
|
||||
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))
|
||||
|
||||
# Override lazy detection by evaluating after the fact.
|
||||
|
Loading…
Reference in New Issue
Block a user