Skip to content

Commit

Permalink
assume minor version satisfies
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsogo committed Dec 10, 2020
1 parent 4c369fe commit 7ee396e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions recipes/entt/3.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def _source_subfolder(self):
def configure(self):
# FIXME: Here we are implementing a workaround because ConanCenter is not generating any configuration with
# C++17 support (either supported by default by a compiler or using 'compiler.cppstd=17' in the Conan profile)
# and ConanCenter requires that at least one package is generated. Once, ConanCenter iterates a profile using
# and ConanCenter requires that at least one package is generated. Once ConanCenter uses a profile
# with C++17 support, only a raw call to `tools.check_mis_cppstd(self, "17")` will be required.
minimal_cpp_standard = "17"
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, minimal_cpp_standard)

minimal_version = {
"Visual Studio": "15",
"Visual Studio": "15.9",
"gcc": "7",
"clang": "5",
"apple-clang": "10"
Expand All @@ -42,8 +42,15 @@ def configure(self):
"%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard))
return

version = tools.Version(self.settings.compiler.version)
if version < minimal_version[compiler]:
# Compare versions asuming minor satisfies if not explicitly set
def gte_compiler_version(version1, version2):
v1, *v1_res = version1.split(".", 1)
v2, *v2_res = version2.split(".", 1)
if v1 == v2 and v1_res and v2_res:
return gte_compiler_version(v1_res, v2_res)
return v1 >= v2

if not gte_compiler_version(str(self.settings.compiler.version), minimal_version[compiler]):
raise ConanInvalidConfiguration(
"%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard))

Expand Down

0 comments on commit 7ee396e

Please sign in to comment.