From 0fe5add2a722e7c74d0733d87fbb4d16de30b45e Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 21:52:27 +0200 Subject: [PATCH 01/48] Added a recipe for reflectcpp --- recipes/reflectcpp/all/conandata.yml | 4 + recipes/reflectcpp/all/conanfile.py | 115 ++++++++++++++++++ .../all/test_package/CMakeLists.txt | 12 ++ .../reflectcpp/all/test_package/conanfile.py | 26 ++++ .../reflectcpp/all/test_package/src/main.cpp | 51 ++++++++ recipes/reflectcpp/config.yml | 3 + 6 files changed, 211 insertions(+) create mode 100644 recipes/reflectcpp/all/conandata.yml create mode 100644 recipes/reflectcpp/all/conanfile.py create mode 100644 recipes/reflectcpp/all/test_package/CMakeLists.txt create mode 100644 recipes/reflectcpp/all/test_package/conanfile.py create mode 100644 recipes/reflectcpp/all/test_package/src/main.cpp create mode 100644 recipes/reflectcpp/config.yml diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml new file mode 100644 index 0000000000000..ce636b4f89b05 --- /dev/null +++ b/recipes/reflectcpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.14.0": + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.0.tar.gz" + sha256: "ea92a2460a71184b7d4fa4e9baad9910efad092df78b114459a7d6b0ee558d3c" diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py new file mode 100644 index 0000000000000..4673bdf2614c7 --- /dev/null +++ b/recipes/reflectcpp/all/conanfile.py @@ -0,0 +1,115 @@ +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": True, + "with_msgpack": False, + "with_toml": False, + "with_xml": False, + "with_yaml": False, + } + src_folder = "src" + build_requires = "cmake/3.30.1" + + @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(cli_args=["-DREFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF"]) + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def requirements(self): + self.requires("ctre/3.9.0", transitive_headers=True) + 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"] diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a3dd04589c0d4 --- /dev/null +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.30) + +project(reflectcpp-test) + +find_package(reflectcpp CONFIG REQUIRED) + +add_executable(reflectcpp-test src/main.cpp) + +target_link_libraries( + reflectcpp-test + reflectcpp::reflectcpp +) diff --git a/recipes/reflectcpp/all/test_package/conanfile.py b/recipes/reflectcpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f8b0c58457933 --- /dev/null +++ b/recipes/reflectcpp/all/test_package/conanfile.py @@ -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, "reflectcpp-test") + self.run(cmd, env="conanrun") diff --git a/recipes/reflectcpp/all/test_package/src/main.cpp b/recipes/reflectcpp/all/test_package/src/main.cpp new file mode 100644 index 0000000000000..6f3ebc664a9b6 --- /dev/null +++ b/recipes/reflectcpp/all/test_package/src/main.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include + +int main(int argc, char** argv) { + using Age = + rfl::Validator, rfl::Maximum<130>>; + + struct Person { + rfl::Rename<"firstName", std::string> first_name; + rfl::Rename<"lastName", std::string> last_name = "Simpson"; + std::string town = "Springfield"; + rfl::Timestamp<"%Y-%m-%d"> birthday; + Age age; + rfl::Email email; + std::vector children; + }; + + const auto bart = Person{.first_name = "Bart", + .birthday = "1987-04-19", + .age = 10, + .email = "bart@simpson.com"}; + + const auto lisa = Person{.first_name = "Lisa", + .birthday = "1987-04-19", + .age = 8, + .email = "lisa@simpson.com"}; + + const auto maggie = Person{.first_name = "Maggie", + .birthday = "1987-04-19", + .age = 0, + .email = "maggie@simpson.com"}; + + const auto homer = + Person{.first_name = "Homer", + .birthday = "1987-04-19", + .age = 45, + .email = "homer@simpson.com", + .children = std::vector({bart, lisa, maggie})}; + + const std::string expected = std::string( + R"({"firstName":"Homer","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":45,"email":"homer@simpson.com","children":[{"firstName":"Bart","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":10,"email":"bart@simpson.com","children":[]},{"firstName":"Lisa","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":8,"email":"lisa@simpson.com","children":[]},{"firstName":"Maggie","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":0,"email":"maggie@simpson.com","children":[]}]})"); + + const auto json_str = rfl::json::write(homer); + + if (json_str != expected) { + throw std::runtime_error("Expected: " + expected + + ", got: " + json_str); + } +} diff --git a/recipes/reflectcpp/config.yml b/recipes/reflectcpp/config.yml new file mode 100644 index 0000000000000..c7af7f7d76847 --- /dev/null +++ b/recipes/reflectcpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.14.0": + folder: all From 5b594c2f0c3454f6ff1566a6c345f08be8d1874d Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 22:18:16 +0200 Subject: [PATCH 02/48] Reduced minimum version required for CMake in the test pipeline --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index a3dd04589c0d4..540d5f4d3bfab 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.30) +cmake_minimum_required(VERSION 3.15) project(reflectcpp-test) From d8d561ae1d9e164b140b19c16367a3afd330d23d Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 22:29:40 +0200 Subject: [PATCH 03/48] Even simpler test --- .../reflectcpp/all/test_package/src/main.cpp | 46 +------------------ 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/recipes/reflectcpp/all/test_package/src/main.cpp b/recipes/reflectcpp/all/test_package/src/main.cpp index 6f3ebc664a9b6..5783f744cd181 100644 --- a/recipes/reflectcpp/all/test_package/src/main.cpp +++ b/recipes/reflectcpp/all/test_package/src/main.cpp @@ -1,51 +1,9 @@ +#include #include #include #include #include int main(int argc, char** argv) { - using Age = - rfl::Validator, rfl::Maximum<130>>; - - struct Person { - rfl::Rename<"firstName", std::string> first_name; - rfl::Rename<"lastName", std::string> last_name = "Simpson"; - std::string town = "Springfield"; - rfl::Timestamp<"%Y-%m-%d"> birthday; - Age age; - rfl::Email email; - std::vector children; - }; - - const auto bart = Person{.first_name = "Bart", - .birthday = "1987-04-19", - .age = 10, - .email = "bart@simpson.com"}; - - const auto lisa = Person{.first_name = "Lisa", - .birthday = "1987-04-19", - .age = 8, - .email = "lisa@simpson.com"}; - - const auto maggie = Person{.first_name = "Maggie", - .birthday = "1987-04-19", - .age = 0, - .email = "maggie@simpson.com"}; - - const auto homer = - Person{.first_name = "Homer", - .birthday = "1987-04-19", - .age = 45, - .email = "homer@simpson.com", - .children = std::vector({bart, lisa, maggie})}; - - const std::string expected = std::string( - R"({"firstName":"Homer","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":45,"email":"homer@simpson.com","children":[{"firstName":"Bart","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":10,"email":"bart@simpson.com","children":[]},{"firstName":"Lisa","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":8,"email":"lisa@simpson.com","children":[]},{"firstName":"Maggie","lastName":"Simpson","town":"Springfield","birthday":"1987-04-19","age":0,"email":"maggie@simpson.com","children":[]}]})"); - - const auto json_str = rfl::json::write(homer); - - if (json_str != expected) { - throw std::runtime_error("Expected: " + expected + - ", got: " + json_str); - } + std::cout << "Able to include and link successfully." << std::endl; } From e0ae8fb9cdf82bb3d7aaeac3bcbd9d735c767884 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 22:37:29 +0200 Subject: [PATCH 04/48] Set minimum C++ standard and compiler versions --- recipes/reflectcpp/all/conanfile.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 4673bdf2614c7..789255d293c60 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -113,3 +113,17 @@ def source(self): def package_info(self): self.cpp_info.libs = ["reflectcpp"] + + @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", + } From f82bb821ed466fb50b7eb59852e374559a8dbcc1 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 22:56:35 +0200 Subject: [PATCH 05/48] Restricted the settings to C++20 --- recipes/reflectcpp/all/conanfile.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 789255d293c60..34362aec7a287 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -25,7 +25,17 @@ class ReflectCppConan(ConanFile): "yaml", ) package_type = "library" - settings = "os", "compiler", "build_type", "arch" + settings = { + "os": ["Linux", "Windows", "Macos"], + "compiler": { + "gcc": {"cppstd": [20]}, + "msvc": {"cppstd": [20]}, + "clang": {"cppstd": [20]}, + }, + "arch": None, + "build_type": None, + } + options = { "shared": [True, False], "fPIC": [True, False], From c9ee4a45863e515572bdbf734f0dc5b22a4e6614 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 23:07:11 +0200 Subject: [PATCH 06/48] Adapted the conanfile in the test package as well --- .../reflectcpp/all/test_package/conanfile.py | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/conanfile.py b/recipes/reflectcpp/all/test_package/conanfile.py index f8b0c58457933..002b22b9f43f8 100644 --- a/recipes/reflectcpp/all/test_package/conanfile.py +++ b/recipes/reflectcpp/all/test_package/conanfile.py @@ -6,7 +6,16 @@ class reflect_cppTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = { + "os": ["Linux", "Windows", "Macos"], + "compiler": { + "gcc": {"cppstd": [20]}, + "msvc": {"cppstd": [20]}, + "clang": {"cppstd": [20]}, + }, + "arch": None, + "build_type": None, + } generators = "CMakeDeps", "CMakeToolchain" def requirements(self): @@ -24,3 +33,17 @@ def test(self): if can_run(self): cmd = os.path.join(self.cpp.build.bindir, "reflectcpp-test") self.run(cmd, env="conanrun") + + @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", + } From b67c805257f5ccad83d3435836919073f0eaec9a Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 6 Aug 2024 23:08:16 +0200 Subject: [PATCH 07/48] Removed duplicate entries --- recipes/reflectcpp/all/conanfile.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 34362aec7a287..64163937ffd48 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -123,17 +123,3 @@ def source(self): def package_info(self): self.cpp_info.libs = ["reflectcpp"] - - @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", - } From d48062d8f9bec1a224b41ba621ebbf01030cd22e Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Wed, 7 Aug 2024 09:18:04 +0200 Subject: [PATCH 08/48] Use original test package; removed settings --- recipes/reflectcpp/all/conanfile.py | 11 +--- .../all/test_package/CMakeLists.txt | 18 +++---- .../reflectcpp/all/test_package/conanfile.py | 51 +++++++------------ .../reflectcpp/all/test_package/src/main.cpp | 9 ---- .../all/test_package/test_package.cpp | 29 +++++++++++ 5 files changed, 56 insertions(+), 62 deletions(-) delete mode 100644 recipes/reflectcpp/all/test_package/src/main.cpp create mode 100644 recipes/reflectcpp/all/test_package/test_package.cpp diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 64163937ffd48..6978fe2c4ebba 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -25,16 +25,7 @@ class ReflectCppConan(ConanFile): "yaml", ) package_type = "library" - settings = { - "os": ["Linux", "Windows", "Macos"], - "compiler": { - "gcc": {"cppstd": [20]}, - "msvc": {"cppstd": [20]}, - "clang": {"cppstd": [20]}, - }, - "arch": None, - "build_type": None, - } + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 540d5f4d3bfab..4dc2551a10743 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -1,12 +1,12 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) -project(reflectcpp-test) +find_package(reflectcpp REQUIRED CONFIG) -find_package(reflectcpp CONFIG REQUIRED) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) -add_executable(reflectcpp-test src/main.cpp) - -target_link_libraries( - reflectcpp-test - reflectcpp::reflectcpp -) +if(CONAN_TEST_WITH_MSGPACK) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_TEST_WITH_MSGPACK) +endif() diff --git a/recipes/reflectcpp/all/test_package/conanfile.py b/recipes/reflectcpp/all/test_package/conanfile.py index 002b22b9f43f8..c0ce5c17be896 100644 --- a/recipes/reflectcpp/all/test_package/conanfile.py +++ b/recipes/reflectcpp/all/test_package/conanfile.py @@ -1,49 +1,32 @@ -import os - from conan import ConanFile -from conan.tools.cmake import CMake, cmake_layout from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +import os -class reflect_cppTestConan(ConanFile): - settings = { - "os": ["Linux", "Windows", "Macos"], - "compiler": { - "gcc": {"cppstd": [20]}, - "msvc": {"cppstd": [20]}, - "clang": {"cppstd": [20]}, - }, - "arch": None, - "build_type": None, - } - generators = "CMakeDeps", "CMakeToolchain" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + if self.dependencies[self.tested_reference_str].options.with_msgpack: + tc.cache_variables["CONAN_TEST_WITH_MSGPACK"] = True + tc.generate() + 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, "reflectcpp-test") - self.run(cmd, env="conanrun") - - @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", - } + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/reflectcpp/all/test_package/src/main.cpp b/recipes/reflectcpp/all/test_package/src/main.cpp deleted file mode 100644 index 5783f744cd181..0000000000000 --- a/recipes/reflectcpp/all/test_package/src/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include -#include -#include -#include - -int main(int argc, char** argv) { - std::cout << "Able to include and link successfully." << std::endl; -} diff --git a/recipes/reflectcpp/all/test_package/test_package.cpp b/recipes/reflectcpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ce23fd7d255f5 --- /dev/null +++ b/recipes/reflectcpp/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +#if defined(CONAN_TEST_WITH_MSGPACK) +#include +#endif + +struct TestStruct { + int x; + std::string name; +}; + +int main(void) { + for (const auto& f : rfl::fields()) { + (void)f.name(); + (void)f.type(); + } + +#if defined(CONAN_TEST_WITH_MSGPACK) + const auto test = TestStruct{.x = 15, .name = "test_package"}; + std::cout << "msgpack test: "; + rfl::msgpack::write(test, std::cout) << std::endl; +#endif + + std::cout << "reflectcpp test successful\n"; + + return 0; +} From 7a1df971dbed041f44247f5e0952f726cdebdf25 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Wed, 7 Aug 2024 09:37:13 +0200 Subject: [PATCH 09/48] Added validate --- recipes/reflectcpp/all/conanfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 6978fe2c4ebba..fe4808100c46d 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -114,3 +114,18 @@ def source(self): def package_info(self): self.cpp_info.libs = ["reflectcpp"] + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + # Validate the minimum cpp standard supported when installing the package. For C++ projects only + 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." + ) From 6f2246dc8d119c560150be447f0ca6600751d845 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Wed, 7 Aug 2024 09:45:38 +0200 Subject: [PATCH 10/48] Added missing imports --- recipes/reflectcpp/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index fe4808100c46d..b374b3bb25198 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -1,6 +1,10 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.files import get, copy from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.scm import Version + import os required_conan_version = ">=1.51.1" From 9b726202700ef514a924d918db9d2ef776b7c9ce Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 7 Aug 2024 10:05:12 +0200 Subject: [PATCH 11/48] PR review Signed-off-by: Uilian Ries --- recipes/reflect-cpp/all/conanfile.py | 4 + recipes/reflectcpp/all/conanfile.py | 82 ++++++++++++------- .../all/test_package/CMakeLists.txt | 6 +- .../reflectcpp/all/test_package/conanfile.py | 4 +- .../all/test_package/test_package.cpp | 31 ++----- 5 files changed, 68 insertions(+), 59 deletions(-) diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py index 30e94da61ba89..00b9cea0d4c22 100644 --- a/recipes/reflect-cpp/all/conanfile.py +++ b/recipes/reflect-cpp/all/conanfile.py @@ -82,6 +82,10 @@ def source(self): def package(self): copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) copy( + + + + self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 6978fe2c4ebba..8fa7b8e670241 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -1,9 +1,13 @@ from conan import ConanFile -from conan.tools.files import get, copy +from conan.tools.files import get, copy, rmdir from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54" class ReflectCppConan(ConanFile): @@ -32,7 +36,6 @@ class ReflectCppConan(ConanFile): "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], @@ -43,14 +46,11 @@ class ReflectCppConan(ConanFile): "fPIC": True, "with_cbor": False, "with_flatbuffers": False, - "with_json": True, "with_msgpack": False, "with_toml": False, "with_xml": False, "with_yaml": False, } - src_folder = "src" - build_requires = "cmake/3.30.1" @property def _min_cppstd(self): @@ -61,8 +61,8 @@ def _compilers_minimum_version(self): return { "Visual Studio": "17", "msvc": "193", - "gcc": "11.4", - "clang": "16", + "gcc": "11", + "clang": "13", "apple-clang": "15", } @@ -74,32 +74,13 @@ 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(cli_args=["-DREFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF"]) - cmake.build() - - def package(self): - cmake = CMake(self) - cmake.install() - def requirements(self): self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.10.0", transitive_headers=True) 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) + self.requires("flatbuffers/24.3.25", transitive_headers=True) if self.options.with_msgpack: self.requires("msgpack-c/6.0.0", transitive_headers=True) if self.options.with_toml: @@ -109,8 +90,51 @@ def requirements(self): if self.options.with_yaml: self.requires("yaml-cpp/0.8.0", transitive_headers=True) + def build_requirements(self): + self.tool_requires("cmake/[>=3.23 <4]") + + def validate(self): + if self.settings.get_safe("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 layout(self): + cmake_layout(self, src_folder="src") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False + tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor + tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers + tc.cache_variables["REFLECTCPP_MSGPACK"] = self.options.with_msgpack + tc.cache_variables["REFLECTCPP_TOML"] = self.options.with_toml + tc.cache_variables["REFLECTCPP_XML"] = self.options.with_xml + tc.cache_variables["REFLECTCPP_YAML"] = self.options.with_yaml + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): self.cpp_info.libs = ["reflectcpp"] + if self.settings.os in ["FreeBSD", "Linux"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 4dc2551a10743..6e641a78d62a9 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(reflectcpp REQUIRED CONFIG) @@ -6,7 +6,3 @@ find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) - -if(CONAN_TEST_WITH_MSGPACK) - target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_TEST_WITH_MSGPACK) -endif() diff --git a/recipes/reflectcpp/all/test_package/conanfile.py b/recipes/reflectcpp/all/test_package/conanfile.py index c0ce5c17be896..a66d61a9b1e97 100644 --- a/recipes/reflectcpp/all/test_package/conanfile.py +++ b/recipes/reflectcpp/all/test_package/conanfile.py @@ -14,11 +14,9 @@ def requirements(self): def layout(self): cmake_layout(self) - + def generate(self): tc = CMakeToolchain(self) - if self.dependencies[self.tested_reference_str].options.with_msgpack: - tc.cache_variables["CONAN_TEST_WITH_MSGPACK"] = True tc.generate() def build(self): diff --git a/recipes/reflectcpp/all/test_package/test_package.cpp b/recipes/reflectcpp/all/test_package/test_package.cpp index ce23fd7d255f5..a8a1ea67de341 100644 --- a/recipes/reflectcpp/all/test_package/test_package.cpp +++ b/recipes/reflectcpp/all/test_package/test_package.cpp @@ -1,29 +1,16 @@ +#include #include -#include #include -#if defined(CONAN_TEST_WITH_MSGPACK) -#include -#endif +#include "rfl.hpp" +#include "rfl/Generic.hpp" +#include "rfl/json.hpp" -struct TestStruct { - int x; - std::string name; -}; int main(void) { - for (const auto& f : rfl::fields()) { - (void)f.name(); - (void)f.type(); - } - -#if defined(CONAN_TEST_WITH_MSGPACK) - const auto test = TestStruct{.x = 15, .name = "test_package"}; - std::cout << "msgpack test: "; - rfl::msgpack::write(test, std::cout) << std::endl; -#endif - - std::cout << "reflectcpp test successful\n"; - - return 0; + auto person = rfl::Generic::Object(); + person["first_name"] = "John"; + person["last_name"] = "Doe"; + rfl::json::write(person, std::cout) << std::endl; + return EXIT_SUCCESS; } From 6a2baf36eb7afd49a756472301d59f7f8b85c44b Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 7 Aug 2024 10:08:42 +0200 Subject: [PATCH 12/48] fix old recipe Signed-off-by: Uilian Ries --- recipes/reflect-cpp/all/conanfile.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py index 00b9cea0d4c22..30e94da61ba89 100644 --- a/recipes/reflect-cpp/all/conanfile.py +++ b/recipes/reflect-cpp/all/conanfile.py @@ -82,10 +82,6 @@ def source(self): def package(self): copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) copy( - - - - self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), From b47a29602abb854e1a733e94bcc770472f58df46 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Wed, 7 Aug 2024 13:06:21 +0200 Subject: [PATCH 13/48] Removed duplicate definition of validate --- recipes/reflectcpp/all/conanfile.py | 35 +++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 3d1d9870908ca..46ab65ea0c019 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -97,9 +97,16 @@ def build_requirements(self): def validate(self): if self.settings.get_safe("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.") + 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 layout(self): cmake_layout(self, src_folder="src") @@ -130,25 +137,15 @@ def build(self): cmake.build() def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["reflectcpp"] - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - # Validate the minimum cpp standard supported when installing the package. For C++ projects only - 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." - ) From 207568b4ddb8901986d791b28a435f6bcf9ef754 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 8 Aug 2024 10:17:52 +0200 Subject: [PATCH 14/48] Retrigger the pipeline --- recipes/reflectcpp/all/conanfile.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 46ab65ea0c019..822dac8cf1f62 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -53,20 +53,6 @@ class ReflectCppConan(ConanFile): "with_yaml": False, } - @property - def _min_cppstd(self): - return 20 - - @property - def _compilers_minimum_version(self): - return { - "Visual Studio": "17", - "msvc": "193", - "gcc": "11", - "clang": "13", - "apple-clang": "15", - } - def config_options(self): if self.settings.os == "Windows": self.options.rm_safe("fPIC") @@ -149,3 +135,17 @@ def package(self): def package_info(self): self.cpp_info.libs = ["reflectcpp"] + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "11", + "clang": "13", + "apple-clang": "15", + } From 322bd49f7055c8cba1d2d4f19e1b6fb2f418aa39 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 13 Aug 2024 09:55:17 +0200 Subject: [PATCH 15/48] Link yyjson in the test environment --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 6e641a78d62a9..b11dd646e4db7 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(reflectcpp REQUIRED CONFIG) +find_package(yyjson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) +target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp yyjson::yyjson) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From b926c03846ec1f09271d21333aa8b51e28253427 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 13 Aug 2024 10:07:37 +0200 Subject: [PATCH 16/48] Use yyjson 0.8.0 --- recipes/reflectcpp/all/conanfile.py | 2 +- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 822dac8cf1f62..fbe46f92095fb 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -63,7 +63,7 @@ def configure(self): def requirements(self): self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.10.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index b11dd646e4db7..e003bc680eeb4 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ find_package(reflectcpp REQUIRED CONFIG) find_package(yyjson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp yyjson::yyjson) +target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From ac6a6799adb19c7229eab7cea656ef3ba12a2e04 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Tue, 13 Aug 2024 10:31:43 +0200 Subject: [PATCH 17/48] Link to YYJSON in the test package --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index e003bc680eeb4..b11dd646e4db7 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ find_package(reflectcpp REQUIRED CONFIG) find_package(yyjson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) +target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp yyjson::yyjson) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From a3dd4097ac833193485eca25abb4baab89876335 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 15 Aug 2024 10:24:24 +0200 Subject: [PATCH 18/48] Removed yyjson again --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index b11dd646e4db7..e003bc680eeb4 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ find_package(reflectcpp REQUIRED CONFIG) find_package(yyjson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp yyjson::yyjson) +target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From 127b389a124b180201351ec33f617c374c1bee06 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 15 Aug 2024 11:28:51 +0200 Subject: [PATCH 19/48] Make sure that shared=True compiles as well --- recipes/reflectcpp/all/conanfile.py | 7 ++++--- recipes/reflectcpp/all/test_package/CMakeLists.txt | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index fbe46f92095fb..d7c469bfdad7a 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,8 +62,9 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + if not self.options.shared: + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -107,7 +108,7 @@ def generate(self): deps.generate() tc = CMakeToolchain(self) tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index e003bc680eeb4..12fbecade7fa1 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(reflectcpp REQUIRED CONFIG) -find_package(yyjson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) +target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From 17d98e816f6ef39e0aeff8609f50d7c7b86629b3 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 15 Aug 2024 12:20:17 +0200 Subject: [PATCH 20/48] Added upstream fix to make MSVC work --- recipes/reflectcpp/all/conandata.yml | 6 +++--- recipes/reflectcpp/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml index ce636b4f89b05..35cb06793898e 100644 --- a/recipes/reflectcpp/all/conandata.yml +++ b/recipes/reflectcpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "0.14.0": - url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.0.tar.gz" - sha256: "ea92a2460a71184b7d4fa4e9baad9910efad092df78b114459a7d6b0ee558d3c" + "0.14.1": + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.1.tar.gz" + sha256: "639aec9d33025703a58d32c231ab1ab474c0cc4fb0ff90eadcaffb49271c41cd" diff --git a/recipes/reflectcpp/config.yml b/recipes/reflectcpp/config.yml index c7af7f7d76847..57034dd3c96a7 100644 --- a/recipes/reflectcpp/config.yml +++ b/recipes/reflectcpp/config.yml @@ -1,3 +1,3 @@ versions: - "0.14.0": + "0.14.1": folder: all From 79e37b7806de6036ca4236ccb02f6e02a884769f Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 15 Aug 2024 16:07:38 +0200 Subject: [PATCH 21/48] Format the testfile; retrigger pipeline --- recipes/reflectcpp/all/test_package/test_package.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/test_package.cpp b/recipes/reflectcpp/all/test_package/test_package.cpp index a8a1ea67de341..1c46040d570e8 100644 --- a/recipes/reflectcpp/all/test_package/test_package.cpp +++ b/recipes/reflectcpp/all/test_package/test_package.cpp @@ -6,7 +6,6 @@ #include "rfl/Generic.hpp" #include "rfl/json.hpp" - int main(void) { auto person = rfl::Generic::Object(); person["first_name"] = "John"; From 0f593694eaa1ead77565309db3f4ec6582af9064 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Thu, 15 Aug 2024 16:30:04 +0200 Subject: [PATCH 22/48] Fixed the msvc version --- recipes/reflectcpp/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index d7c469bfdad7a..82564eff7bb70 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -145,7 +145,7 @@ def _min_cppstd(self): def _compilers_minimum_version(self): return { "Visual Studio": "17", - "msvc": "193", + "msvc": "1938", "gcc": "11", "clang": "13", "apple-clang": "15", From 1c8d106894c3772c72d1863720244e580b285c1c Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Mon, 23 Sep 2024 11:40:18 +0200 Subject: [PATCH 23/48] Always use external dependencies --- recipes/reflectcpp/all/conanfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 82564eff7bb70..da4b66c830043 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,9 +62,8 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - if not self.options.shared: - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -108,7 +107,7 @@ def generate(self): deps.generate() tc = CMakeToolchain(self) tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers From dbfe7ac57694267df2f297492e06d0ffd2b47b2b Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Mon, 23 Sep 2024 11:56:06 +0200 Subject: [PATCH 24/48] Link to YYJSON --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 12fbecade7fa1..0573b230c4012 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -5,4 +5,5 @@ find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) +target_link_libraries(${PROJECT_NAME} yyjson::yyjson) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From d1e10313a1a3bad1ef052f6e0b76190c6a58e1af Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Mon, 23 Sep 2024 12:28:08 +0200 Subject: [PATCH 25/48] Revert "Link to YYJSON" This reverts commit dbfe7ac57694267df2f297492e06d0ffd2b47b2b. --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 0573b230c4012..12fbecade7fa1 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -5,5 +5,4 @@ find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) -target_link_libraries(${PROJECT_NAME} yyjson::yyjson) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From e1fa84635d24c3803e3cd039b19156331170d6ad Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Mon, 23 Sep 2024 12:28:18 +0200 Subject: [PATCH 26/48] Revert "Always use external dependencies" This reverts commit 1c8d106894c3772c72d1863720244e580b285c1c. --- recipes/reflectcpp/all/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index da4b66c830043..82564eff7bb70 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,8 +62,9 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + if not self.options.shared: + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -107,7 +108,7 @@ def generate(self): deps.generate() tc = CMakeToolchain(self) tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers From 5a16fbfb6d575bbb89bb579e03a41030ae0d23b7 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sat, 9 Nov 2024 20:54:35 +0100 Subject: [PATCH 27/48] Tried using BUILD_SHARED_LIBS --- recipes/reflectcpp/all/conanfile.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 82564eff7bb70..3c2c1a560b41d 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,9 +62,8 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - if not self.options.shared: - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -107,8 +106,8 @@ def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) - tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers From 98fd462fe0e5d48032b2f32bb40ee7a9d0c7c28a Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sat, 9 Nov 2024 21:00:54 +0100 Subject: [PATCH 28/48] Go back to old solution, once again --- recipes/reflectcpp/all/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 3c2c1a560b41d..027262a1e441f 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,8 +62,9 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + if not self.options.shared: + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -107,7 +108,7 @@ def generate(self): deps.generate() tc = CMakeToolchain(self) tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers From 77626dc63e86736e6c38d30cf7c5f6d05233dd82 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 9 Nov 2024 21:31:02 +0100 Subject: [PATCH 29/48] Added version 0.15.0 --- recipes/reflectcpp/all/conandata.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml index 35cb06793898e..31ab300fa77a6 100644 --- a/recipes/reflectcpp/all/conandata.yml +++ b/recipes/reflectcpp/all/conandata.yml @@ -2,3 +2,6 @@ sources: "0.14.1": url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.1.tar.gz" sha256: "639aec9d33025703a58d32c231ab1ab474c0cc4fb0ff90eadcaffb49271c41cd" + "0.15.0": + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.15.0.tar.gz" + sha256: "ba9bf362b34acd5b402954e0c3f386e0089e6e4e808b79f35dd12c13ec5f2225" From c222ca445961c48f562be3a0f8828d2d0dec18fc Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 9 Nov 2024 21:34:20 +0100 Subject: [PATCH 30/48] Updated config.yml as well --- recipes/reflectcpp/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/reflectcpp/config.yml b/recipes/reflectcpp/config.yml index 57034dd3c96a7..e2d662c8c7b57 100644 --- a/recipes/reflectcpp/config.yml +++ b/recipes/reflectcpp/config.yml @@ -1,3 +1,5 @@ versions: "0.14.1": folder: all + "0.15.0": + folder: all From 96f530ecf7b6ef1885ad5684010f694c191a5a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Mon, 18 Nov 2024 15:54:49 +0100 Subject: [PATCH 31/48] Update recipes/reflectcpp/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/reflectcpp/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 027262a1e441f..8edf3acb93fd0 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -108,7 +108,7 @@ def generate(self): deps.generate() tc = CMakeToolchain(self) tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers From 629c90d814c414b8b251111db4921ba3071ca1e2 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 14:57:57 +0100 Subject: [PATCH 32/48] Always link to ctre and yyjson --- recipes/reflectcpp/all/conanfile.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 8edf3acb93fd0..9d8a6c2728d4b 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -62,9 +62,8 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - if not self.options.shared: - self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + self.requires("ctre/3.9.0", transitive_headers=True) + self.requires("yyjson/0.8.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: @@ -84,16 +83,9 @@ def build_requirements(self): def validate(self): if self.settings.get_safe("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." - ) + 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 layout(self): cmake_layout(self, src_folder="src") From f114de50ef50727457d5deb8c8663307bac1ac9e Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 16:18:01 +0100 Subject: [PATCH 33/48] Try using the 0.16.0 release candidate --- recipes/reflectcpp/all/conandata.yml | 9 +++------ recipes/reflectcpp/config.yml | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml index 31ab300fa77a6..cf0522c4531cc 100644 --- a/recipes/reflectcpp/all/conandata.yml +++ b/recipes/reflectcpp/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "0.14.1": - url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.14.1.tar.gz" - sha256: "639aec9d33025703a58d32c231ab1ab474c0cc4fb0ff90eadcaffb49271c41cd" - "0.15.0": - url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.15.0.tar.gz" - sha256: "ba9bf362b34acd5b402954e0c3f386e0089e6e4e808b79f35dd12c13ec5f2225" + "0.16.0: + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0-rc1.tar.gz" + sha256: "0abe40769b81d9c1f69f05d31424d66e5ba0382cdad20fa6ecb769ba3c3d1dfb" diff --git a/recipes/reflectcpp/config.yml b/recipes/reflectcpp/config.yml index e2d662c8c7b57..e5e40881d5003 100644 --- a/recipes/reflectcpp/config.yml +++ b/recipes/reflectcpp/config.yml @@ -1,5 +1,3 @@ versions: - "0.14.1": - folder: all - "0.15.0": + "0.16.0": folder: all From f4d94c5adfad635097f68c0585ed5f03eba72d62 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 16:22:03 +0100 Subject: [PATCH 34/48] Fixed syntax error --- recipes/reflectcpp/all/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml index cf0522c4531cc..d81b1d163f126 100644 --- a/recipes/reflectcpp/all/conandata.yml +++ b/recipes/reflectcpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "0.16.0: + "0.16.0": url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0-rc1.tar.gz" sha256: "0abe40769b81d9c1f69f05d31424d66e5ba0382cdad20fa6ecb769ba3c3d1dfb" From b757c280cad554addaa3a9127510a4a093e7b64d Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 16:31:37 +0100 Subject: [PATCH 35/48] Explicitly add yyjson --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 12fbecade7fa1..e57114e0028c8 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package LANGUAGES CXX) find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) +target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp yyjson::yyjson) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From 6e4b548399029fb06c15e236b73244a48c6ac521 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 16:37:31 +0100 Subject: [PATCH 36/48] Try yyjson 0.10.0 --- recipes/reflectcpp/all/conanfile.py | 2 +- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 9d8a6c2728d4b..fe3cd9c58dc53 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -63,7 +63,7 @@ def configure(self): def requirements(self): self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.8.0", transitive_headers=True) + self.requires("yyjson/0.10.0", transitive_headers=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index e57114e0028c8..12fbecade7fa1 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package LANGUAGES CXX) find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp yyjson::yyjson) +target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) From e5c9555b1cf9f3567eee08565beeebd5c6d36831 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 16:57:52 +0100 Subject: [PATCH 37/48] Added some linker flags to the tests --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 12fbecade7fa1..30303dedc22eb 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -6,3 +6,5 @@ find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries") From 1d166677ad214b7bf8d85b86d0d4aec3877735f6 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 17:37:20 +0100 Subject: [PATCH 38/48] Added UBJSON support --- recipes/reflectcpp/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index fe3cd9c58dc53..3fc88ef68f3e5 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -39,6 +39,7 @@ class ReflectCppConan(ConanFile): "with_flatbuffers": [True, False], "with_msgpack": [True, False], "with_toml": [True, False], + "with_ubjson": [True, False], "with_xml": [True, False], "with_yaml": [True, False], } @@ -49,6 +50,7 @@ class ReflectCppConan(ConanFile): "with_flatbuffers": False, "with_msgpack": False, "with_toml": False, + "with_ubjson": False, "with_xml": False, "with_yaml": False, } @@ -72,6 +74,8 @@ def requirements(self): 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_ubjson: + self.requires("jsoncons/0.176.0", transitive_headers=True) if self.options.with_xml: self.requires("pugixml/1.14", transitive_headers=True) if self.options.with_yaml: From 8c75f550b7036c38518de0044535a1e3879cdb20 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 21:17:03 +0100 Subject: [PATCH 39/48] Use REFLECTCPP_BUILD_SHARED --- recipes/reflectcpp/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 3fc88ef68f3e5..594d82509a779 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -103,7 +103,7 @@ def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) - tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor From 8eb59612e5eec7ef9aee2be720184f04d5701b54 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 23 Nov 2024 21:48:44 +0100 Subject: [PATCH 40/48] Use the final 0.16.0 release version --- recipes/reflectcpp/all/conandata.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml index d81b1d163f126..cb9c3acfa130e 100644 --- a/recipes/reflectcpp/all/conandata.yml +++ b/recipes/reflectcpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: "0.16.0": - url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0-rc1.tar.gz" - sha256: "0abe40769b81d9c1f69f05d31424d66e5ba0382cdad20fa6ecb769ba3c3d1dfb" + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0.tar.gz" + sha256: "a84d94dbd353d788926d6e54507b44c046863f7bc4ecb35afe0338374a68a77d" From e87ab3687afdf37401691b582f3a042007e23bdc Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 26 Nov 2024 10:13:30 +0100 Subject: [PATCH 41/48] Removed linker flag --- recipes/reflectcpp/all/test_package/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt index 30303dedc22eb..74f3b52f1538e 100644 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ b/recipes/reflectcpp/all/test_package/CMakeLists.txt @@ -7,4 +7,3 @@ add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries") From c4503be95272b2e1c3afaaaf8bc93975e80e4638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Tue, 26 Nov 2024 11:34:25 +0100 Subject: [PATCH 42/48] Update recipes/reflectcpp/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/reflectcpp/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 594d82509a779..40c53463a43b5 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -65,7 +65,9 @@ def configure(self): def requirements(self): self.requires("ctre/3.9.0", transitive_headers=True) - self.requires("yyjson/0.10.0", transitive_headers=True) + # INFO: include/rfl/json/Writer.hpp includes yyjson.h + # INFO: Transitive lib needed to avoid undefined reference to symbol 'yyjson_mut_doc_new' + self.requires("yyjson/0.10.0", transitive_headers=True, transitive_libs=True) if self.options.with_cbor: self.requires("tinycbor/0.6.0", transitive_headers=True) if self.options.with_flatbuffers: From 7f85707ac6614a34eb4099ca28820202bf813b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Tue, 26 Nov 2024 11:34:36 +0100 Subject: [PATCH 43/48] Update recipes/reflectcpp/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/reflectcpp/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 40c53463a43b5..61c34b1a1955d 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -98,6 +98,7 @@ def layout(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 20)", "") def generate(self): env = VirtualBuildEnv(self) From 22888d9abe00b06a600ab88d074b3591d89001a6 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 26 Nov 2024 11:39:44 +0100 Subject: [PATCH 44/48] Added missing import --- recipes/reflectcpp/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 61c34b1a1955d..6c1933a73f0ad 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import get, copy, rmdir +from conan.tools.files import get, copy, rmdir, replace_in_file from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.env import VirtualBuildEnv from conan.tools.build import check_min_cppstd From ef12bee90d1d7ecfe47ac631c272136cd05a8a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Tue, 26 Nov 2024 13:39:05 +0100 Subject: [PATCH 45/48] Update recipes/reflectcpp/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/reflectcpp/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py index 6c1933a73f0ad..8d031b42ce9da 100644 --- a/recipes/reflectcpp/all/conanfile.py +++ b/recipes/reflectcpp/all/conanfile.py @@ -104,6 +104,8 @@ def generate(self): env = VirtualBuildEnv(self) env.generate() deps = CMakeDeps(self) + if self.options.with_flatbuffers: + deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") deps.generate() tc = CMakeToolchain(self) tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared From ebafb6d464e08e2a5d4cd219262a8e038880d0a4 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 26 Nov 2024 14:13:24 +0100 Subject: [PATCH 46/48] Rename to reflect-cpp and use Conan 2.x Signed-off-by: Uilian Ries --- recipes/reflect-cpp/all/conandata.yml | 15 +- recipes/reflect-cpp/all/conanfile.py | 152 ++++++++++------- .../all/test_package/CMakeLists.txt | 9 +- .../reflect-cpp/all/test_package/conanfile.py | 4 +- .../all/test_package/test_package.cpp | 34 ++-- recipes/reflect-cpp/config.yml | 8 +- recipes/reflectcpp/all/conandata.yml | 4 - recipes/reflectcpp/all/conanfile.py | 153 ------------------ .../all/test_package/CMakeLists.txt | 9 -- .../reflectcpp/all/test_package/conanfile.py | 30 ---- .../all/test_package/test_package.cpp | 15 -- recipes/reflectcpp/config.yml | 3 - 12 files changed, 111 insertions(+), 325 deletions(-) delete mode 100644 recipes/reflectcpp/all/conandata.yml delete mode 100644 recipes/reflectcpp/all/conanfile.py delete mode 100644 recipes/reflectcpp/all/test_package/CMakeLists.txt delete mode 100644 recipes/reflectcpp/all/test_package/conanfile.py delete mode 100644 recipes/reflectcpp/all/test_package/test_package.cpp delete mode 100644 recipes/reflectcpp/config.yml diff --git a/recipes/reflect-cpp/all/conandata.yml b/recipes/reflect-cpp/all/conandata.yml index ad65b35cf4e50..cb9c3acfa130e 100644 --- a/recipes/reflect-cpp/all/conandata.yml +++ b/recipes/reflect-cpp/all/conandata.yml @@ -1,13 +1,4 @@ sources: - "0.11.1": - url: "https://github.com/getml/reflect-cpp/archive/v0.11.1.tar.gz" - sha256: "e45f112fb3f14507a4aa53b99ae2d4ab6a4e7b2d5f04dd06fec00bf7faa7bbdc" - "0.11.0": - url: "https://github.com/getml/reflect-cpp/archive/v0.11.0.tar.gz" - sha256: "85f66939608acacf66dc782529af0c5a36b7d695c55b310b10c49700251b6221" - "0.10.0": - url: "https://github.com/getml/reflect-cpp/archive/v0.10.0.tar.gz" - sha256: "d2c8876d993ddc8c57c5804e767786bdb46a2bdf1a6cd81f4b14f57b1552dfd7" - "0.6.0": - url: "https://github.com/getml/reflect-cpp/archive/v0.6.0.tar.gz" - sha256: "D8231B91989397A67E841B56A0673FDCDF969DBE956D54BB629F14100B030664" + "0.16.0": + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0.tar.gz" + sha256: "a84d94dbd353d788926d6e54507b44c046863f7bc4ecb35afe0338374a68a77d" diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py index 30e94da61ba89..a045fe224b54a 100644 --- a/recipes/reflect-cpp/all/conanfile.py +++ b/recipes/reflect-cpp/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.env import VirtualBuildEnv from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version -from conan.tools.layout import basic_layout + import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=2.0.9" + class ReflectCppConan(ConanFile): name = "reflect-cpp" @@ -14,82 +15,115 @@ class ReflectCppConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/getml/reflect-cpp" - topics = ("reflection", "serialization", "memory", "json", "xml", "flatbuffers", "yaml", "toml", "msgpack", "header-only") - package_type = "header-library" + topics = ( + "reflection", + "serialization", + "memory", + "cbor", + "flatbuffers", + "json", + "msgpack", + "toml", + "xml", + "yaml", + ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" + options = { - "with_json" : [True, False], - "with_xml" : [True, False], - "with_flatbuffers" : [True, False], - "with_yaml": [True, False], + "shared": [True, False], + "fPIC": [True, False], + "with_cbor": [True, False], + "with_flatbuffers": [True, False], "with_msgpack": [True, False], + "with_toml": [True, False], + "with_ubjson": [True, False], + "with_xml": [True, False], + "with_yaml": [True, False], } default_options = { - "with_json" : False, - "with_xml" : False, - "with_flatbuffers" : False, - "with_yaml" : False, - "with_msgpack": False, + "shared": False, + "fPIC": True, + "with_cbor": False, + "with_flatbuffers": False, + "with_msgpack": False, + "with_toml": False, + "with_ubjson": False, + "with_xml": False, + "with_yaml": False, } - - @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 layout(self): - basic_layout(self, src_folder="src") + implements = ["auto_shared_fpic"] def requirements(self): - if self.options.with_json: - self.requires("yyjson/0.8.0", transitive_headers=True) + self.requires("ctre/3.9.0", transitive_headers=True) + # INFO: include/rfl/json/Writer.hpp includes yyjson.h + # INFO: Transitive lib needed to avoid undefined reference to symbol 'yyjson_mut_doc_new' + self.requires("yyjson/0.10.0", transitive_headers=True, transitive_libs=True) + if self.options.with_cbor: + self.requires("tinycbor/0.6.0", transitive_headers=True) + if self.options.with_flatbuffers: + self.requires("flatbuffers/24.3.25", 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_ubjson: + self.requires("jsoncons/0.176.0", transitive_headers=True) if self.options.with_xml: self.requires("pugixml/1.14", transitive_headers=True) - if self.options.with_flatbuffers: - self.requires("flatbuffers/23.5.26", transitive_headers=True) if self.options.with_yaml: self.requires("yaml-cpp/0.8.0", transitive_headers=True) - if self.options.with_msgpack: - self.requires("msgpack-c/6.0.0", transitive_headers=True) - - if Version(self.version) >= "0.11.1": - self.requires("ctre/3.9.0", transitive_headers=True) - def package_id(self): - self.info.clear() + def build_requirements(self): + self.tool_requires("cmake/[>=3.23 <4]") def validate(self): - if self.settings.get_safe("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." - ) + check_min_cppstd(self, 20) + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + # INFO: Let Conan handle the C++ standard used via settings.compiler.cppstd + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 20)", "") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + deps = CMakeDeps(self) + if self.options.with_flatbuffers: + deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False + tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor + tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers + tc.cache_variables["REFLECTCPP_MSGPACK"] = self.options.with_msgpack + tc.cache_variables["REFLECTCPP_TOML"] = self.options.with_toml + tc.cache_variables["REFLECTCPP_XML"] = self.options.with_xml + tc.cache_variables["REFLECTCPP_YAML"] = self.options.with_yaml + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) copy( self, - pattern="*.hpp", - dst=os.path.join(self.package_folder, "include"), - src=os.path.join(self.source_folder, "include"), + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, ) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.bindirs = [] - self.cpp_info.libdirs = [] - if Version(self.version) >= "0.11.1": - self.cpp_info.defines.append("REFLECTCPP_NO_BUNDLED_DEPENDENCIES") + self.cpp_info.libs = ["reflectcpp"] + self.cpp_info.set_property("cmake_target_name", "reflectcpp::reflectcpp") + self.cpp_info.set_property("cmake_file_name", "reflectcpp") diff --git a/recipes/reflect-cpp/all/test_package/CMakeLists.txt b/recipes/reflect-cpp/all/test_package/CMakeLists.txt index 767315c296e76..74f3b52f1538e 100644 --- a/recipes/reflect-cpp/all/test_package/CMakeLists.txt +++ b/recipes/reflect-cpp/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(reflect-cpp REQUIRED CONFIG) +find_package(reflectcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE reflect-cpp::reflect-cpp) +target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) -if(CONAN_TEST_WITH_MSGPACK) - target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_TEST_WITH_MSGPACK) -endif() diff --git a/recipes/reflect-cpp/all/test_package/conanfile.py b/recipes/reflect-cpp/all/test_package/conanfile.py index c0ce5c17be896..a66d61a9b1e97 100644 --- a/recipes/reflect-cpp/all/test_package/conanfile.py +++ b/recipes/reflect-cpp/all/test_package/conanfile.py @@ -14,11 +14,9 @@ def requirements(self): def layout(self): cmake_layout(self) - + def generate(self): tc = CMakeToolchain(self) - if self.dependencies[self.tested_reference_str].options.with_msgpack: - tc.cache_variables["CONAN_TEST_WITH_MSGPACK"] = True tc.generate() def build(self): diff --git a/recipes/reflect-cpp/all/test_package/test_package.cpp b/recipes/reflect-cpp/all/test_package/test_package.cpp index ed7b54690e256..1c46040d570e8 100644 --- a/recipes/reflect-cpp/all/test_package/test_package.cpp +++ b/recipes/reflect-cpp/all/test_package/test_package.cpp @@ -1,29 +1,15 @@ -#include +#include #include -#include - -#if defined(CONAN_TEST_WITH_MSGPACK) - #include -#endif +#include -struct TestStruct { - int x; - std::string name; -}; +#include "rfl.hpp" +#include "rfl/Generic.hpp" +#include "rfl/json.hpp" int main(void) { - for (const auto& f : rfl::fields()) { - (void) f.name(); - (void) f.type(); - } - -#if defined(CONAN_TEST_WITH_MSGPACK) - const auto test = TestStruct{.x = 15, .name = "test_package"}; - std::cout << "msgpack test: "; - rfl::msgpack::write(test, std::cout) << std::endl; -#endif - - std::cout << "reflect-cpp test successful\n"; - - return 0; + auto person = rfl::Generic::Object(); + person["first_name"] = "John"; + person["last_name"] = "Doe"; + rfl::json::write(person, std::cout) << std::endl; + return EXIT_SUCCESS; } diff --git a/recipes/reflect-cpp/config.yml b/recipes/reflect-cpp/config.yml index 1fd3a60496588..e5e40881d5003 100644 --- a/recipes/reflect-cpp/config.yml +++ b/recipes/reflect-cpp/config.yml @@ -1,9 +1,3 @@ versions: - "0.11.1": - folder: all - "0.11.0": - folder: all - "0.10.0": - folder: all - "0.6.0": + "0.16.0": folder: all diff --git a/recipes/reflectcpp/all/conandata.yml b/recipes/reflectcpp/all/conandata.yml deleted file mode 100644 index cb9c3acfa130e..0000000000000 --- a/recipes/reflectcpp/all/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.16.0": - url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0.tar.gz" - sha256: "a84d94dbd353d788926d6e54507b44c046863f7bc4ecb35afe0338374a68a77d" diff --git a/recipes/reflectcpp/all/conanfile.py b/recipes/reflectcpp/all/conanfile.py deleted file mode 100644 index 8d031b42ce9da..0000000000000 --- a/recipes/reflectcpp/all/conanfile.py +++ /dev/null @@ -1,153 +0,0 @@ -from conan import ConanFile -from conan.tools.files import get, copy, rmdir, replace_in_file -from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps -from conan.tools.env import VirtualBuildEnv -from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration - -import os - -required_conan_version = ">=1.54" - - -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", "arch", "compiler", "build_type" - - options = { - "shared": [True, False], - "fPIC": [True, False], - "with_cbor": [True, False], - "with_flatbuffers": [True, False], - "with_msgpack": [True, False], - "with_toml": [True, False], - "with_ubjson": [True, False], - "with_xml": [True, False], - "with_yaml": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - "with_cbor": False, - "with_flatbuffers": False, - "with_msgpack": False, - "with_toml": False, - "with_ubjson": False, - "with_xml": False, - "with_yaml": False, - } - - 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 requirements(self): - self.requires("ctre/3.9.0", transitive_headers=True) - # INFO: include/rfl/json/Writer.hpp includes yyjson.h - # INFO: Transitive lib needed to avoid undefined reference to symbol 'yyjson_mut_doc_new' - self.requires("yyjson/0.10.0", transitive_headers=True, transitive_libs=True) - if self.options.with_cbor: - self.requires("tinycbor/0.6.0", transitive_headers=True) - if self.options.with_flatbuffers: - self.requires("flatbuffers/24.3.25", 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_ubjson: - self.requires("jsoncons/0.176.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 build_requirements(self): - self.tool_requires("cmake/[>=3.23 <4]") - - def validate(self): - if self.settings.get_safe("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 layout(self): - cmake_layout(self, src_folder="src") - - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 20)", "") - - def generate(self): - env = VirtualBuildEnv(self) - env.generate() - deps = CMakeDeps(self) - if self.options.with_flatbuffers: - deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") - deps.generate() - tc = CMakeToolchain(self) - tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared - tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False - tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False - tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor - tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers - tc.cache_variables["REFLECTCPP_MSGPACK"] = self.options.with_msgpack - tc.cache_variables["REFLECTCPP_TOML"] = self.options.with_toml - tc.cache_variables["REFLECTCPP_XML"] = self.options.with_xml - tc.cache_variables["REFLECTCPP_YAML"] = self.options.with_yaml - tc.generate() - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def package(self): - copy( - self, - pattern="LICENSE", - dst=os.path.join(self.package_folder, "licenses"), - src=self.source_folder, - ) - cmake = CMake(self) - cmake.install() - rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - - def package_info(self): - self.cpp_info.libs = ["reflectcpp"] - - @property - def _min_cppstd(self): - return 20 - - @property - def _compilers_minimum_version(self): - return { - "Visual Studio": "17", - "msvc": "1938", - "gcc": "11", - "clang": "13", - "apple-clang": "15", - } diff --git a/recipes/reflectcpp/all/test_package/CMakeLists.txt b/recipes/reflectcpp/all/test_package/CMakeLists.txt deleted file mode 100644 index 74f3b52f1538e..0000000000000 --- a/recipes/reflectcpp/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package LANGUAGES CXX) - -find_package(reflectcpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) - diff --git a/recipes/reflectcpp/all/test_package/conanfile.py b/recipes/reflectcpp/all/test_package/conanfile.py deleted file mode 100644 index a66d61a9b1e97..0000000000000 --- a/recipes/reflectcpp/all/test_package/conanfile.py +++ /dev/null @@ -1,30 +0,0 @@ -from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - test_type = "explicit" - - def requirements(self): - self.requires(self.tested_reference_str) - - def layout(self): - cmake_layout(self) - - def generate(self): - tc = CMakeToolchain(self) - tc.generate() - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun") diff --git a/recipes/reflectcpp/all/test_package/test_package.cpp b/recipes/reflectcpp/all/test_package/test_package.cpp deleted file mode 100644 index 1c46040d570e8..0000000000000 --- a/recipes/reflectcpp/all/test_package/test_package.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -#include "rfl.hpp" -#include "rfl/Generic.hpp" -#include "rfl/json.hpp" - -int main(void) { - auto person = rfl::Generic::Object(); - person["first_name"] = "John"; - person["last_name"] = "Doe"; - rfl::json::write(person, std::cout) << std::endl; - return EXIT_SUCCESS; -} diff --git a/recipes/reflectcpp/config.yml b/recipes/reflectcpp/config.yml deleted file mode 100644 index e5e40881d5003..0000000000000 --- a/recipes/reflectcpp/config.yml +++ /dev/null @@ -1,3 +0,0 @@ -versions: - "0.16.0": - folder: all From b7351326861525e2a084a384247aebf7e1d4ebc3 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 26 Nov 2024 14:22:39 +0100 Subject: [PATCH 47/48] Check compiler version Signed-off-by: Uilian Ries --- recipes/reflect-cpp/all/conanfile.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py index a045fe224b54a..f753a0e74188b 100644 --- a/recipes/reflect-cpp/all/conanfile.py +++ b/recipes/reflect-cpp/all/conanfile.py @@ -3,6 +3,8 @@ from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.env import VirtualBuildEnv from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os @@ -30,6 +32,15 @@ class ReflectCppConan(ConanFile): package_type = "library" settings = "os", "arch", "compiler", "build_type" + @property + def _compilers_minimum_version(self): + return { + "msvc": "193", + "gcc": "11", + "clang": "13", + "apple-clang": "15", + } + options = { "shared": [True, False], "fPIC": [True, False], @@ -79,6 +90,9 @@ def build_requirements(self): def validate(self): check_min_cppstd(self, 20) + 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++20 features, which your compiler does not fully support.") def layout(self): cmake_layout(self, src_folder="src") From 20042e32292cccb00b9f35f929b8c99333f5eb2c Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 26 Nov 2024 15:00:53 +0100 Subject: [PATCH 48/48] Require MSVC 194 for now Signed-off-by: Uilian Ries --- recipes/reflect-cpp/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py index f753a0e74188b..86e30443a2c97 100644 --- a/recipes/reflect-cpp/all/conanfile.py +++ b/recipes/reflect-cpp/all/conanfile.py @@ -34,8 +34,10 @@ class ReflectCppConan(ConanFile): @property def _compilers_minimum_version(self): + # TODO: MSVC 19.38 is required, but ConanCenterIndex CI has update 6 installed. + # Update msvc to 193 when having the CI updated to the latest update. return { - "msvc": "193", + "msvc": "194", "gcc": "11", "clang": "13", "apple-clang": "15",