From 2123628a68ac6cb7c8f230e5b1b589011ee6183e Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Tue, 27 Feb 2024 10:12:34 +0100 Subject: [PATCH 1/8] asio-grpc: Add version 3.0.0 --- recipes/asio-grpc/all/conandata.yml | 3 +++ recipes/asio-grpc/all/conanfile.py | 20 ++++++++++--------- .../asio-grpc/all/test_package/CMakeLists.txt | 4 ---- .../all/test_package/test_package.cpp | 17 +++------------- recipes/asio-grpc/config.yml | 2 ++ 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index fceefbebebc47..0ac0801843276 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v3.0.0.tar.gz" + sha256: "299b937cba0b515e7505840ffb891ce8745879365cd918635401f19bf4886591" "2.9.2": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.9.2.tar.gz" sha256: "a025587278b3332f4c5dd0464b3d5313fbecb89fc58a6ec1d611f693d6b51ef2" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index c686e567d9288..b09691394e263 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -52,21 +52,22 @@ def configure(self): (self.settings.compiler == "gcc" and compiler_version < "9") or \ (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" - if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": + if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex" and Version(self.version) < "3.0.0": raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") def requirements(self): - self.requires("grpc/1.54.3", transitive_libs=True) - if self._local_allocator_option == "boost_container" or self.options.backend == "boost": + self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) + if (self._local_allocator_option == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": self.requires("boost/1.83.0", transitive_headers=True) if self.options.backend == "asio": self.requires("asio/1.29.0", transitive_headers=True) if self.options.backend == "unifex": - self.requires("libunifex/0.4.0") + self.requires("libunifex/0.4.0", transitive_headers=True, transitive_libs=True) def package_id(self): self.info.clear() - self.info.options.local_allocator = self._local_allocator_option + if Version(self.version) < "3.0.0": + self.info.options.local_allocator = self._local_allocator_option def layout(self): cmake_layout(self, src_folder="src") @@ -95,8 +96,9 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" - tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" + if Version(self.version) < "3.0.0": + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" + tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" tc.generate() def build(self): @@ -115,7 +117,7 @@ def package_info(self): build_modules = [os.path.join("lib", "cmake", "asio-grpc", "AsioGrpcProtobufGenerator.cmake")] - self.cpp_info.requires = ["grpc::grpc++_unsecure"] + self.cpp_info.requires = ["grpc::grpc++"] if self.options.backend == "boost": self.cpp_info.defines = ["AGRPC_BOOST_ASIO"] self.cpp_info.requires.append("boost::headers") @@ -126,7 +128,7 @@ def package_info(self): self.cpp_info.defines = ["AGRPC_UNIFEX"] self.cpp_info.requires.append("libunifex::unifex") - if self._local_allocator_option == "boost_container": + if self._local_allocator_option == "boost_container" and Version(self.version) < "3.0.0": self.cpp_info.requires.append("boost::container") self.cpp_info.set_property("cmake_file_name", "asio-grpc") diff --git a/recipes/asio-grpc/all/test_package/CMakeLists.txt b/recipes/asio-grpc/all/test_package/CMakeLists.txt index 3566d527f1ca9..c63f764daa261 100644 --- a/recipes/asio-grpc/all/test_package/CMakeLists.txt +++ b/recipes/asio-grpc/all/test_package/CMakeLists.txt @@ -7,10 +7,6 @@ add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE asio-grpc::asio-grpc) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -# See https://github.com/chriskohlhoff/asio/issues/955 -target_compile_definitions(${PROJECT_NAME} - PRIVATE BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC) - if(${asio-grpc_VERSION} VERSION_GREATER_EQUAL 2) target_compile_definitions(${PROJECT_NAME} PRIVATE ASIO_GRPC_V2) endif() diff --git a/recipes/asio-grpc/all/test_package/test_package.cpp b/recipes/asio-grpc/all/test_package/test_package.cpp index b784be03686dc..6b7094c7b7c60 100644 --- a/recipes/asio-grpc/all/test_package/test_package.cpp +++ b/recipes/asio-grpc/all/test_package/test_package.cpp @@ -16,21 +16,10 @@ int main() { boost::asio::post(grpc_context, [] {}); #ifndef CROSSCOMPILING - std::unique_ptr stub; - grpc::ClientContext client_context; - std::unique_ptr> reader; - test::TestRequest request; - test::TestReply response; - grpc::Status status; - - boost::asio::post(grpc_context, [&]() { - stub = test::Test::NewStub(grpc::CreateChannel( + boost::asio::post(grpc_context, []() { + [[maybe_unused]] auto stub = test::Test::NewStub(grpc::CreateChannel( "localhost:50051", grpc::InsecureChannelCredentials())); - request.set_message("hello"); - reader = agrpc::request(&test::Test::Stub::AsyncUnary, *stub, - client_context, request, grpc_context); - agrpc::finish(reader, response, status, - boost::asio::bind_executor(grpc_context, [](bool) {})); + [[maybe_unused]] test::TestRequest request; }); #endif } diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index b9f64d2363051..db1e33d31a8f4 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.0": + folder: all "2.9.2": folder: all "2.7.0": From 94b6cd0d0193646fe9cfc7e96963237284571b7c Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Mon, 8 Jul 2024 17:54:49 +0200 Subject: [PATCH 2/8] Removed local_allocator from config_options on >v3.0.0 --- recipes/asio-grpc/all/conanfile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index b09691394e263..b736dbc48b1dc 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -43,8 +43,12 @@ def _compilers_minimum_version(self): "apple-clang": "11", } + def config_options(self): + if Version(self.version) >= "3.0.0": + del self.options.local_allocator + def configure(self): - self._local_allocator_option = self.options.local_allocator + self._local_allocator_option = self.options.get_safe("local_allocator") if self._local_allocator_option == "auto": libcxx = self.settings.compiler.get_safe("libcxx") compiler_version = Version(self.settings.compiler.version) @@ -52,7 +56,7 @@ def configure(self): (self.settings.compiler == "gcc" and compiler_version < "9") or \ (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" - if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex" and Version(self.version) < "3.0.0": + if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") def requirements(self): @@ -66,7 +70,7 @@ def requirements(self): def package_id(self): self.info.clear() - if Version(self.version) < "3.0.0": + if self._local_allocator_option: self.info.options.local_allocator = self._local_allocator_option def layout(self): From d34b0186b52a72ec16713059693385f0ef44d95f Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Tue, 9 Jul 2024 10:53:28 +0200 Subject: [PATCH 3/8] asio-grpc: Change v3.0.0 to v3.1.0 --- recipes/asio-grpc/all/conandata.yml | 6 +++--- recipes/asio-grpc/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index 0ac0801843276..dd5d504a13768 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "3.0.0": - url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v3.0.0.tar.gz" - sha256: "299b937cba0b515e7505840ffb891ce8745879365cd918635401f19bf4886591" + "3.1.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v3.1.0.tar.gz" + sha256: "b5d9440dad653dcb9e5ac82cb9c4f6d01a33bc30bba996d9647f38258cbe75ee" "2.9.2": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.9.2.tar.gz" sha256: "a025587278b3332f4c5dd0464b3d5313fbecb89fc58a6ec1d611f693d6b51ef2" diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index db1e33d31a8f4..19340d578742c 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,5 +1,5 @@ versions: - "3.0.0": + "3.1.0": folder: all "2.9.2": folder: all From 7f08b0515e7058379bf4f11955eb11bd92cb5387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Thu, 11 Jul 2024 21:49:34 +0200 Subject: [PATCH 4/8] Better way to handle option property --- recipes/asio-grpc/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index b736dbc48b1dc..4716846e14408 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -42,13 +42,16 @@ def _compilers_minimum_version(self): "clang": "6", "apple-clang": "11", } + + @property + def _local_allocator_option(self): + return self.options.get_safe("local_allocator") def config_options(self): if Version(self.version) >= "3.0.0": del self.options.local_allocator def configure(self): - self._local_allocator_option = self.options.get_safe("local_allocator") if self._local_allocator_option == "auto": libcxx = self.settings.compiler.get_safe("libcxx") compiler_version = Version(self.settings.compiler.version) From a194c71159ad8f126b8a91c676cd444fd9d047b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Tue, 16 Jul 2024 12:39:07 +0200 Subject: [PATCH 5/8] Fix handling of local_allocator option --- recipes/asio-grpc/all/conanfile.py | 46 +++++++++++++----------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index 4716846e14408..2f3c9fee11809 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -21,11 +21,11 @@ class AsioGrpcConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "backend": ["boost", "asio", "unifex"], - "local_allocator": ["auto", "memory_resource", "boost_container", "recycling_allocator"], + "local_allocator": ["memory_resource", "boost_container", "recycling_allocator"], } default_options = { "backend": "boost", - "local_allocator": "auto", + # local_allocator default handled in config_options } no_copy_source = True @@ -42,29 +42,21 @@ def _compilers_minimum_version(self): "clang": "6", "apple-clang": "11", } - - @property - def _local_allocator_option(self): - return self.options.get_safe("local_allocator") def config_options(self): if Version(self.version) >= "3.0.0": del self.options.local_allocator - - def configure(self): - if self._local_allocator_option == "auto": + else: libcxx = self.settings.compiler.get_safe("libcxx") compiler_version = Version(self.settings.compiler.version) prefer_boost_container = libcxx and str(libcxx) == "libc++" or \ - (self.settings.compiler == "gcc" and compiler_version < "9") or \ - (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") - self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" - if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": - raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") + (self.settings.compiler == "gcc" and compiler_version < "9") or \ + (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") + self.options.local_allocator = "boost_container" if prefer_boost_container else "memory_resource" def requirements(self): self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) - if (self._local_allocator_option == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": + if (self.options.get_safe("local_allocator") == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": self.requires("boost/1.83.0", transitive_headers=True) if self.options.backend == "asio": self.requires("asio/1.29.0", transitive_headers=True) @@ -72,9 +64,13 @@ def requirements(self): self.requires("libunifex/0.4.0", transitive_headers=True, transitive_libs=True) def package_id(self): + local_allocator = None + if "local_allocator" in self.info.options: + local_allocator = self.info.options.local_allocator self.info.clear() - if self._local_allocator_option: - self.info.options.local_allocator = self._local_allocator_option + if local_allocator is not None: + # Keep the local_allocator option in the package_id + self.info.options.local_allocator = local_allocator def layout(self): cmake_layout(self, src_folder="src") @@ -89,23 +85,21 @@ def validate(self): raise ConanInvalidConfiguration( f"{self.name} requires C++{self._min_cppstd}, which your compiler does not support." ) - else: - self.output.warning( - f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports" - f" C++{self._min_cppstd}." - ) if Version(self.version) == "2.7.0" and self.settings.compiler == "gcc" and compiler_version.major == "11" and \ - compiler_version < "11.3": + compiler_version < "11.3": raise ConanInvalidConfiguration(f"{self.ref} does not support gcc 11.0-11.2") + if self.options.get_safe("local_allocator") == "recycling_allocator" and self.options.backend == "unifex": + raise ConanInvalidConfiguration(f'{self.name} -o="&:local_allocator=recycling_allocator" cannot be used in combination with the -o="&:backend=unifex" backend.') + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) if Version(self.version) < "3.0.0": - tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" - tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.get_safe("local_allocator") == "boost_container" + tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self.options.get_safe("local_allocator") == "recycling_allocator" tc.generate() def build(self): @@ -135,7 +129,7 @@ def package_info(self): self.cpp_info.defines = ["AGRPC_UNIFEX"] self.cpp_info.requires.append("libunifex::unifex") - if self._local_allocator_option == "boost_container" and Version(self.version) < "3.0.0": + if self.options.get_safe("local_allocator") == "boost_container" and Version(self.version) < "3.0.0": self.cpp_info.requires.append("boost::container") self.cpp_info.set_property("cmake_file_name", "asio-grpc") From 775dfc976f654d68ac267785f43d261e06f2c23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 22 Jul 2024 00:40:36 +0200 Subject: [PATCH 6/8] Bumo boost and asio --- recipes/asio-grpc/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index 2f3c9fee11809..22c7eaf173a4d 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -57,9 +57,9 @@ def config_options(self): def requirements(self): self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) if (self.options.get_safe("local_allocator") == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": - self.requires("boost/1.83.0", transitive_headers=True) + self.requires("boost/1.85.0", transitive_headers=True) if self.options.backend == "asio": - self.requires("asio/1.29.0", transitive_headers=True) + self.requires("asio/1.30.2", transitive_headers=True) if self.options.backend == "unifex": self.requires("libunifex/0.4.0", transitive_headers=True, transitive_libs=True) From 465722f9a304b4123a656fb93bc128400ab3e4cc Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Sat, 3 Aug 2024 13:21:32 +0200 Subject: [PATCH 7/8] asio-grpc: Select lower asio version for older versions of asio-grpc --- recipes/asio-grpc/all/conanfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index 22c7eaf173a4d..e7923e36791b8 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -55,11 +55,14 @@ def config_options(self): self.options.local_allocator = "boost_container" if prefer_boost_container else "memory_resource" def requirements(self): + use_latest = Version(self.version) > "2.8" self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) if (self.options.get_safe("local_allocator") == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": - self.requires("boost/1.85.0", transitive_headers=True) + version = "1.85.0" if use_latest else "1.83.0" + self.requires(f"boost/{version}", transitive_headers=True) if self.options.backend == "asio": - self.requires("asio/1.30.2", transitive_headers=True) + version = "1.30.2" if use_latest else "1.29.0" + self.requires(f"asio/{version}", transitive_headers=True) if self.options.backend == "unifex": self.requires("libunifex/0.4.0", transitive_headers=True, transitive_libs=True) From 2916665601d235975096d0d68cdc6145287493d0 Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Mon, 16 Sep 2024 15:48:33 +0200 Subject: [PATCH 8/8] asio-grpc: Update 3.1.0 to 3.2.0 --- recipes/asio-grpc/all/conandata.yml | 6 +++--- recipes/asio-grpc/all/conanfile.py | 4 ++-- recipes/asio-grpc/config.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index dd5d504a13768..82e6288a3b1b7 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "3.1.0": - url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v3.1.0.tar.gz" - sha256: "b5d9440dad653dcb9e5ac82cb9c4f6d01a33bc30bba996d9647f38258cbe75ee" + "3.2.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v3.2.0.tar.gz" + sha256: "f281e84202cf75aae055d67c4200b794f240cd7bd9ff8ecc3f9670a8912edf4f" "2.9.2": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.9.2.tar.gz" sha256: "a025587278b3332f4c5dd0464b3d5313fbecb89fc58a6ec1d611f693d6b51ef2" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index e7923e36791b8..19e1514deae2c 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -58,10 +58,10 @@ def requirements(self): use_latest = Version(self.version) > "2.8" self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) if (self.options.get_safe("local_allocator") == "boost_container" and Version(self.version) < "3.0.0") or self.options.backend == "boost": - version = "1.85.0" if use_latest else "1.83.0" + version = "1.86.0" if use_latest else "1.83.0" self.requires(f"boost/{version}", transitive_headers=True) if self.options.backend == "asio": - version = "1.30.2" if use_latest else "1.29.0" + version = "1.31.0" if use_latest else "1.29.0" self.requires(f"asio/{version}", transitive_headers=True) if self.options.backend == "unifex": self.requires("libunifex/0.4.0", transitive_headers=True, transitive_libs=True) diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index 19340d578742c..e5e2925fb424e 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,5 +1,5 @@ versions: - "3.1.0": + "3.2.0": folder: all "2.9.2": folder: all