diff --git a/recipes/mdspan/all/conanfile.py b/recipes/mdspan/all/conanfile.py index 2e8201c6f1d4dc..89dfb6ebe7a29f 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) @@ -49,6 +58,11 @@ def configure(self): 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(tools.Version(self.settings.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.", tools.Version(self.settings.compiler.version)) + def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)