diff --git a/recipes/zserio/all/conandata.yml b/recipes/zserio/all/conandata.yml index 9a65ed8b0e67c..252e1a38c700d 100644 --- a/recipes/zserio/all/conandata.yml +++ b/recipes/zserio/all/conandata.yml @@ -1,4 +1,14 @@ sources: + "2.14.0": + runtime: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.0/zserio-2.14.0-runtime-libs.zip" + sha256: "6002bfe179333435c84d3be2cfb612c008bd52837512aecea8a888e4a3139564" + compiler: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.0/zserio-2.14.0-bin.zip" + sha256: "c1d4668371ad3543cb24f86b218640da7f720f31afe3f8af2d427114d7c7ae5c" + license: + url: "https://raw.githubusercontent.com/ndsev/zserio/v2.14.0/LICENSE" + sha256: "8fd7b040fc223bb07551dfed490df0d55d6af25e331e58bc7c7599163ed1bb5a" "2.13.0": runtime: url: "https://github.com/ndsev/zserio/releases/download/v2.13.0/zserio-2.13.0-runtime-libs.zip" diff --git a/recipes/zserio/all/conanfile.py b/recipes/zserio/all/conanfile.py index 2ab5a23336294..6a69b2c814401 100644 --- a/recipes/zserio/all/conanfile.py +++ b/recipes/zserio/all/conanfile.py @@ -5,6 +5,7 @@ from conan.tools.files import copy, download, get from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version required_conan_version = ">=1.54.0" @@ -25,12 +26,24 @@ class ZserioConanFile(ConanFile): "fPIC": True } + @property + def _compilers_minimum_version(self): + # https://github.com/ndsev/zserio/tree/master/compiler/extensions/cpp#supported-compilers + return { + "apple-clang": "11", + "clang": "11", + "gcc": "5", + "msvc": "191", + "Visual Studio": "15", + } + @property def _min_cppstd(self): return 11 def export_sources(self): - copy(self, "zserio_compiler.cmake", self.recipe_folder, self.export_sources_folder) + if Version(self.version) < "2.14.0": + copy(self, "zserio_compiler.cmake", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -50,6 +63,13 @@ def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) + minimum_compiler_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_compiler_version and Version(self.settings.compiler.version) < minimum_compiler_version: + raise ConanInvalidConfiguration( + f"Compiler version '{self.settings.compiler.version}' not supported, " + f"minumum is '{minimum_compiler_version}'!" + ) + def source(self): sources = self.conan_data["sources"][self.version] get(self, **sources["runtime"], strip_root=True) @@ -57,6 +77,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + if not self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = str(self._min_cppstd) tc.generate() def build(self): @@ -65,6 +87,8 @@ def build(self): cmake.build() sources = self.conan_data["sources"][self.version] get(self, **sources["compiler"], pattern="zserio.jar") + if Version(self.version) >= "2.14.0": + get(self, **sources["compiler"], pattern="cmake/zserio_compiler.cmake") @property def _cmake_module_path(self): @@ -80,8 +104,13 @@ def package(self): copy(self, "*.a", self.build_folder, lib_dir, keep_path=False) copy(self, "zserio.jar", self.build_folder, os.path.join(self.package_folder, "bin")) - copy(self, "zserio_compiler.cmake", self.export_sources_folder, - os.path.join(self.package_folder, self._cmake_module_path)) + if Version(self.version) >= "2.14.0": + # from 2.14.0 the cmake script is available directly in zserio repository + copy(self, "zserio_compiler.cmake", os.path.join(self.build_folder, "cmake"), + os.path.join(self.package_folder, self._cmake_module_path)) + else: + copy(self, "zserio_compiler.cmake", self.export_sources_folder, + os.path.join(self.package_folder, self._cmake_module_path)) def package_info(self): self.cpp_info.libs = ["ZserioCppRuntime"] diff --git a/recipes/zserio/config.yml b/recipes/zserio/config.yml index 319f45f887837..24ddb8ef2b935 100644 --- a/recipes/zserio/config.yml +++ b/recipes/zserio/config.yml @@ -1,3 +1,5 @@ versions: + "2.14.0": + folder: all "2.13.0": folder: all