aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-07-31 21:46:19 +0200
committerSimon Warta <[email protected]>2017-07-31 21:48:03 +0200
commitacf8842d9639b7065cc2510968263ded24e0e70c (patch)
treeb9bab378f67126456a05d7ef5d134092d3c87ec3
parentc89d1e9679159753eb983e67699ec3858ca758d6 (diff)
Use native compiler versioning of MSVC
While using marketing names like 2013, 2015 etc. is more convenient at first sight, it requires keeping a table about all supported compiler versions, as there is no formular to calculate between the representations. Keeping a list of compilers leads to the following issue: if one version of Botan is released in 2017, requiring MSVS 2015 for one module, this source can be compiled using MSVS 2015 and 2017 but not a future version like 2019. Also preview/development versions of MSVC that may use an intermediate version number cannot be handled with the marketing name table because they may be unknown to the general public.
-rwxr-xr-xconfigure.py12
-rw-r--r--src/lib/hash/sha1/sha1_x86/info.txt2
-rw-r--r--src/lib/hash/sha2_32/sha2_32_x86/info.txt2
-rwxr-xr-xsrc/scripts/python_uniitests.py8
4 files changed, 12 insertions, 12 deletions
diff --git a/configure.py b/configure.py
index 8557bb9cd..3becd6489 100755
--- a/configure.py
+++ b/configure.py
@@ -2628,15 +2628,9 @@ class CompilerDetector(object):
match = re.search(CompilerDetector._version_patterns[self._cc_name], cc_output, flags=re.MULTILINE)
if match:
if self._cc_name == 'msvc':
- cl_version_to_msvc_version = {
- '18.00': '2013',
- '19.00': '2015',
- '19.10': '2017'
- }
- try:
- cc_version = cl_version_to_msvc_version[match.group(1) + "." + match.group(2)]
- except KeyError:
- raise InternalError('Unknown MSVC version in output "%s"' % (cc_output))
+ major = int(match.group(1))
+ minor = int(match.group(2))
+ return "%d.%d" % (major, minor)
else:
cc_version = match.group(1)
elif match is None and self._cc_name == 'clang' and self._os_name in ['darwin', 'ios']:
diff --git a/src/lib/hash/sha1/sha1_x86/info.txt b/src/lib/hash/sha1/sha1_x86/info.txt
index fa329ae77..9cddd40a2 100644
--- a/src/lib/hash/sha1/sha1_x86/info.txt
+++ b/src/lib/hash/sha1/sha1_x86/info.txt
@@ -7,5 +7,5 @@ need_isa sha,ssse3,sse4.1
<cc>
clang:3.9
gcc:5.0
-msvc:2015
+msvc:19.0 # MSVS 2015
</cc>
diff --git a/src/lib/hash/sha2_32/sha2_32_x86/info.txt b/src/lib/hash/sha2_32/sha2_32_x86/info.txt
index c0b159ab2..bf34e73a3 100644
--- a/src/lib/hash/sha2_32/sha2_32_x86/info.txt
+++ b/src/lib/hash/sha2_32/sha2_32_x86/info.txt
@@ -7,5 +7,5 @@ need_isa sha,sse4.1
<cc>
gcc:5.0
clang:3.9
-msvc:2015
+msvc:19.0 # MSVS 2015
</cc>
diff --git a/src/scripts/python_uniitests.py b/src/scripts/python_uniitests.py
index f7b1bc97e..0f41f3afa 100755
--- a/src/scripts/python_uniitests.py
+++ b/src/scripts/python_uniitests.py
@@ -88,7 +88,13 @@ Selected multilib: .;@m64"""
1900
"""
- self.assertEqual(detector.version_from_compiler_output(compiler_out), "2015")
+ self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.0")
+
+ compiler_out = """msvc_version.c
+
+1910
+"""
+ self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.10")
class ModulesChooserResolveDependencies(unittest.TestCase):