Skip to content

Commit

Permalink
ASIO gRPC boost container fix (#174)
Browse files Browse the repository at this point in the history
# Changes

Moved a number of changes made manually into one of our repositories to
the `find_package` code where it can be used globally.
  • Loading branch information
RReichert committed May 9, 2024
1 parent 117b3f7 commit 68306be
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions FindAsioGrpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,39 @@

include("GenericFindDependency")

# asio-grpc has some logic to conditionally enable boost containers, this
# 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 <memory_resource>" false)

GenericFindDependency(
TARGET asio-grpc::asio-grpc-standalone-asio
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()

0 comments on commit 68306be

Please sign in to comment.