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

Zserio 2.14.0 #23846

Merged
merged 11 commits into from
May 21, 2024
10 changes: 10 additions & 0 deletions recipes/zserio/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
35 changes: 32 additions & 3 deletions recipes/zserio/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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":
Expand All @@ -50,13 +63,22 @@ 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)
download(self, filename="LICENSE", **sources["license"])

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):
Expand All @@ -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":
uilianries marked this conversation as resolved.
Show resolved Hide resolved
get(self, **sources["compiler"], pattern="cmake/zserio_compiler.cmake")

@property
def _cmake_module_path(self):
Expand All @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions recipes/zserio/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"2.14.0":
folder: all
"2.13.0":
folder: all
Loading