Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confu_json: support for c++17 #15199

Merged
merged 16 commits into from
Jan 30, 2023
5 changes: 4 additions & 1 deletion recipes/confu_json/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ sources:
0.0.9:
url: https://github.com/werto87/confu_json/archive/refs/tags/v0.0.9.tar.gz
sha256: 29b2940b939cb04f11fdab4964c86bcb23ac75c588550bf54048e024444d2718
"0.0.10":
0.0.10:
url: "https://github.com/werto87/confu_json/archive/v0.0.10.tar.gz"
sha256: "b31aab1bce952c0dc0bfc1f955a7b88be5103350b5a5eee1a4586ccec0e51fc1"
1.0.0:
url: https://github.com/werto87/confu_json/archive/refs/tags/v1.0.0.tar.gz
sha256: f165172220b440d37a7a8301e490cf791b3b25b0cc3f2a08b355609c5f777db0
57 changes: 31 additions & 26 deletions recipes/confu_json/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from conan import ConanFile, tools
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools import files
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc
from conan.tools.microsoft import is_msvc ,check_min_vs

required_conan_version = ">=1.50.0"

Expand All @@ -19,10 +21,6 @@ class ConfuJson(ConanFile):
def _source_subfolder(self):
return "source_subfolder"

@property
def _minimum_cpp_standard(self):
return 20

@property
def _minimum_compilers_version(self):
return {
Expand All @@ -34,36 +32,43 @@ def _minimum_compilers_version(self):


def configure(self):
if is_msvc(self) and Version(self.version) < "0.0.9":
raise ConanInvalidConfiguration(
"Visual Studio is not supported in versions before confu_json/0.0.9")
if self.settings.compiler == "apple-clang":
raise ConanInvalidConfiguration(
"apple-clang is not supported. Pull request welcome")
if self.settings.compiler.get_safe("cppstd"):
tools.build.check_min_cppstd(self, self._minimum_cpp_standard)

min_version = self._minimum_compilers_version.get(
str(self.settings.compiler))
if not min_version:
self.output.warn("{} recipe lacks information about the {} "
"compiler support.".format(
self.name, self.settings.compiler))
if self.settings.compiler == "gcc" and Version(self.version) < "1.0.0":
raise ConanInvalidConfiguration(
"gcc is only supported in versions greater than or equal 1.0.0.")
if Version(self.version) >= "1.0.0":
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 17)
check_min_vs(self, "1930")
else:
if Version(self.settings.compiler.version) < min_version:
if is_msvc(self) and Version(self.version) < "0.0.9":
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))
"Visual Studio is not supported in versions before confu_json/0.0.9")
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 20)
min_version = self._minimum_compilers_version.get(
str(self.settings.compiler))
if not min_version:
self.output.warning("{} recipe lacks information about the {} "
"compiler support.".format(
self.name, self.settings.compiler))
else:
if Version(self.settings.compiler.version) < min_version:
raise ConanInvalidConfiguration(
"{} requires C++{} support. "
"The current compiler {} {} does not support it.".format(
self.name, 20,
self.settings.compiler,
self.settings.compiler.version))

def requirements(self):
self.requires("boost/1.79.0")
self.requires("boost/1.81.0")
self.requires("magic_enum/0.8.0")

def source(self):
tools.files.get(self, **self.conan_data["sources"][self.version],
files.get(self, **self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def package(self):
Expand Down
4 changes: 3 additions & 1 deletion recipes/confu_json/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ versions:
folder: all
0.0.9:
folder: all
"0.0.10":
0.0.10:
folder: all
1.0.0:
folder: all