diff --git a/recipes/libnghttp2/all/conandata.yml b/recipes/libnghttp2/all/conandata.yml index c95a58d3fe33d..45e916368acfb 100644 --- a/recipes/libnghttp2/all/conandata.yml +++ b/recipes/libnghttp2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.64.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.64.0/nghttp2-1.64.0.tar.bz2" + sha256: "3a670df378e852b85a2295f25e4f51cc28f56e0fcc496408b8c3764290537af5" "1.61.0": url: "https://github.com/nghttp2/nghttp2/releases/download/v1.61.0/nghttp2-1.61.0.tar.bz2" sha256: "4e8cf7ec32d4c5a430966242d72035d255cd9470a8766d61eed7a0190dd544fd" diff --git a/recipes/libnghttp2/all/conanfile.py b/recipes/libnghttp2/all/conanfile.py index 8fa456dd4d783..0227e5e30d626 100644 --- a/recipes/libnghttp2/all/conanfile.py +++ b/recipes/libnghttp2/all/conanfile.py @@ -6,6 +6,7 @@ from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd import os @@ -38,6 +39,33 @@ class Nghttp2Conan(ConanFile): "with_asio": False, } + @property + def _is_using_cpp(self): + return self.options.with_app or self.options.with_hpack or self.options.get_safe("with_asio") + + @property + def _min_cppstd(self): + return "14" if Version(self.version) <= "1.62.0" else "20" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + "20": { + "gcc": "11", + "clang": "12", + "apple-clang": "13", + "Visual Studio": "16", + "msvc": "192", + } + }.get(self._min_cppstd, {}) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -45,7 +73,7 @@ def config_options(self): def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - if not (self.options.with_app or self.options.with_hpack or self.options.with_asio): + if not self._is_using_cpp: self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") if not self.options.with_app: @@ -77,6 +105,14 @@ def validate(self): raise ConanInvalidConfiguration("Build with asio and MSVC is not supported yet, see upstream bug #589") if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 6.0") + if self._is_using_cpp: + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -108,6 +144,10 @@ def generate(self): tc.generate() tc = CMakeDeps(self) + if self.options.with_app: + tc.set_property("libev", "cmake_file_name", "LIBEV") + if self.options.with_hpack: + tc.set_property("jansson", "cmake_file_name", "JANSSON") tc.generate() tc = PkgConfigDeps(self) tc.generate() diff --git a/recipes/libnghttp2/config.yml b/recipes/libnghttp2/config.yml index 99922e9441daf..919ba22bbdb8b 100644 --- a/recipes/libnghttp2/config.yml +++ b/recipes/libnghttp2/config.yml @@ -1,4 +1,6 @@ versions: + "1.64.0": + folder: all "1.61.0": folder: all "1.60.0":