From 150108b80ea3d2fdf09ece4735cb6df1634efd50 Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Wed, 8 May 2024 15:20:29 -0300 Subject: [PATCH 1/3] Exclude Boost containers from ASIO gRPC library --- FindAsioGrpc.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FindAsioGrpc.cmake b/FindAsioGrpc.cmake index 504993e..22507d2 100644 --- a/FindAsioGrpc.cmake +++ b/FindAsioGrpc.cmake @@ -12,6 +12,10 @@ include("GenericFindDependency") +# asio-grpc has some logic to conditionally enable boost containers, this +# should just be default by default. +option(ASIO_GRPC_USE_BOOST_CONTAINER "(deprecated) Use Boost.Container instead of " false) + GenericFindDependency( TARGET asio-grpc::asio-grpc-standalone-asio SOURCE_DIR asio-grpc From 52c7c046a7d5666982785948005e465589b3a2e9 Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Wed, 8 May 2024 15:39:25 -0300 Subject: [PATCH 2/3] Additional ASIO grpc stuff --- FindAsioGrpc.cmake | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/FindAsioGrpc.cmake b/FindAsioGrpc.cmake index 22507d2..f1b2bed 100644 --- a/FindAsioGrpc.cmake +++ b/FindAsioGrpc.cmake @@ -13,7 +13,8 @@ include("GenericFindDependency") # asio-grpc has some logic to conditionally enable boost containers, this -# should just be default by default. +# should just be defaulted to false since the standard library offers the same +# functionality. option(ASIO_GRPC_USE_BOOST_CONTAINER "(deprecated) Use Boost.Container instead of " false) GenericFindDependency( @@ -21,3 +22,29 @@ GenericFindDependency( SOURCE_DIR asio-grpc SYSTEM_INCLUDES ) + +# Older libc++ versions like the one that ships with clang < v16 doesn't offer +# the "memory_resource" standard header which is used by the library, instead +# we conditionally select it to use "experimental/memory_resource" which is +# available. The conditional selection is done via a customer preprocessor +# which we've (Swift Navigation) introduced. +include(CheckExperimentalMemoryResource) +check_experimental_memory_resource(IS_EXPERIMENTAL_MEMORY_RESOURCE) +if (IS_EXPERIMENTAL_MEMORY_RESOURCE) + target_compile_definitions(asio-grpc-standalone-asio + INTERFACE + SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE + ) +endif() + +# asio-grpc uses language features that are removed in c++20, the libc++ +# implementation actually removed these features unless you set a special +# macro. +include(CheckLibcpp) +check_libcpp(IS_LIBCPP) +if (IS_LIBCPP) + target_compile_definitions(asio-grpc-standalone-asio + INTERFACE + _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES + ) +endif() \ No newline at end of file From 0d4c17e45a130ba91f792eccb286269f96e62d16 Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Thu, 9 May 2024 18:37:57 -0300 Subject: [PATCH 3/3] nit --- FindAsioGrpc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FindAsioGrpc.cmake b/FindAsioGrpc.cmake index f1b2bed..05a8bef 100644 --- a/FindAsioGrpc.cmake +++ b/FindAsioGrpc.cmake @@ -47,4 +47,4 @@ if (IS_LIBCPP) INTERFACE _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES ) -endif() \ No newline at end of file +endif()