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

Added support for reflect-cpp v0.14.0; added CBOR and TOML #24819

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 0 additions & 95 deletions recipes/reflect-cpp/all/conanfile.py

This file was deleted.

12 changes: 0 additions & 12 deletions recipes/reflect-cpp/all/test_package/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions recipes/reflect-cpp/all/test_package/conanfile.py

This file was deleted.

29 changes: 0 additions & 29 deletions recipes/reflect-cpp/all/test_package/test_package.cpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"0.14.0":
url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.0.tar.gz"
sha256: "ea92a2460a71184b7d4fa4e9baad9910efad092df78b114459a7d6b0ee558d3c"
"0.11.1":
url: "https://github.com/getml/reflect-cpp/archive/v0.11.1.tar.gz"
sha256: "e45f112fb3f14507a4aa53b99ae2d4ab6a4e7b2d5f04dd06fec00bf7faa7bbdc"
Expand Down
114 changes: 114 additions & 0 deletions recipes/reflectcpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
from conan import ConanFile
from conan.tools.files import get, copy
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
import os

required_conan_version = ">=1.51.1"


class ReflectCppConan(ConanFile):
name = "reflectcpp"
description = "C++-20 library for fast serialization, deserialization and validation using reflection"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/getml/reflect-cpp"
topics = (
"reflection",
"serialization",
"memory",
"cbor",
"flatbuffers",
"json",
"msgpack",
"toml",
"xml",
"yaml",
)
package_type = "library"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_cbor": [True, False],
"with_flatbuffers": [True, False],
"with_json": [True, False],
"with_msgpack": [True, False],
"with_toml": [True, False],
"with_xml": [True, False],
"with_yaml": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_cbor": False,
"with_flatbuffers": False,
"with_json": False,
"with_msgpack": False,
"with_toml": False,
"with_xml": False,
"with_yaml": False,
}
src_folder = "src"
build_requires = "cmake/3.23.5"

@property
def _min_cppstd(self):
return 20

@property
def _compilers_minimum_version(self):
return {
"Visual Studio": "17",
"msvc": "193",
"gcc": "11.4",
"clang": "16",
"apple-clang": "15",
}

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def requirements(self):
if self.options.with_cbor:
self.requires("tinycbor/0.6.0", transitive_headers=True)
if self.options.with_flatbuffers:
self.requires("flatbuffers/23.5.26", transitive_headers=True)
if self.options.with_json:
self.requires("yyjson/0.8.0", transitive_headers=True)
if self.options.with_msgpack:
self.requires("msgpack-c/6.0.0", transitive_headers=True)
if self.options.with_toml:
self.requires("tomlplusplus/3.4.0", transitive_headers=True)
if self.options.with_xml:
self.requires("pugixml/1.14", transitive_headers=True)
if self.options.with_yaml:
self.requires("yaml-cpp/0.8.0", transitive_headers=True)

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

def package_info(self):
self.cpp_info.libs = ["reflectcpp"]
7 changes: 7 additions & 0 deletions recipes/reflectcpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(PackageTest CXX)

find_package(reflectcpp CONFIG REQUIRED)

add_executable(example src/example.cpp)
target_link_libraries(example reflectcpp::reflectcpp)
26 changes: 26 additions & 0 deletions recipes/reflectcpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


class reflect_cppTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "example")
self.run(cmd, env="conanrun")
7 changes: 7 additions & 0 deletions recipes/reflectcpp/all/test_package/src/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <string>
#include <vector>

int main() {
std::vector<std::string> vec;
vec.push_back("test_package");
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"0.14.0":
folder: all
"0.11.1":
folder: all
"0.11.0":
Expand Down