Skip to content

Commit

Permalink
mdspan: Set supported MSVC versions
Browse files Browse the repository at this point in the history
The upstream has a build issues with certain MSVC versions.
See kokkos/mdspan#26 for details.
  • Loading branch information
leha-bot committed Aug 3, 2022
1 parent 4a1d26b commit d734e2e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion recipes/mdspan/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit d734e2e

Please sign in to comment.