From 64c63333ed5797df0649a12468ad3a5edb3905f7 Mon Sep 17 00:00:00 2001 From: leha-bot Date: Wed, 3 Aug 2022 16:59:11 +0300 Subject: [PATCH] mdspan: Set supported MSVC versions The upstream has a build issues with certain MSVC versions. See https://github.com/kokkos/mdspan/issues/26 for details. --- recipes/mdspan/all/conanfile.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/recipes/mdspan/all/conanfile.py b/recipes/mdspan/all/conanfile.py index 2e8201c6f1d4dc..db4eb47777c885 100644 --- a/recipes/mdspan/all/conanfile.py +++ b/recipes/mdspan/all/conanfile.py @@ -32,6 +32,15 @@ def _minimum_compilers_version(self): "apple-clang": "5.1" } + def _is_msvc(self, compiler_name): + return compiler_name == "Visual Studio" + + # According to upstream issue https://github.com/kokkos/mdspan/issues/26 , the MSVC updates to STL has broke the build + # since MSVC 16.6; and seems it built successfully on MSVC 17 + def _msvc_is_supported_version(self, version): + return version < "16.6" or version >= "17.0" + + def configure(self): if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, self._minimum_cpp_standard) @@ -42,13 +51,20 @@ def configure(self): "compiler support.".format( self.name, self.settings.compiler)) else: - if tools.Version(self.settings.compiler.version) < min_version: + compiler_version = tools.Version(self.settings.compiler.version) + if compiler_version < min_version: raise ConanInvalidConfiguration( "{} requires C++{} support. " "The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + if self._is_msvc(str(self.settings.compiler)) and not self._msvc_is_supported_version(compiler_version): + raise ConanInvalidConfiguration( + "Unsupported MSVC version {} due to upstream bug. The supported MSVC versions are > 15.0 and < 16.6 or >= 17.0." + "See upstream issue https://github.com/kokkos/mdspan/issues/26 for details.".format( + compiler.version)) + def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)