From 927e3d8c47c354bac39d968b5e936457cd0879f4 Mon Sep 17 00:00:00 2001
From: Dennis Hezel
Date: Sun, 10 Dec 2023 16:38:15 +0100
Subject: [PATCH] doc: Document how to use stdexec and downgrade to upstream
vcpkg version
---
.github/workflows/build.yml | 2 +-
README.md | 29 ++++++++--
deps/stdexec/portfile.cmake | 58 -------------------
deps/stdexec/vcpkg.json | 17 ------
src/agrpc/detail/manual_reset_event.hpp | 3 +-
.../detail/register_sender_rpc_handler.hpp | 4 +-
src/agrpc/detail/sender_of.hpp | 2 +-
test/cmake/subdirectory/src/vcpkg.json | 2 +-
test/cmake/superbuild/src/vcpkg.json | 2 +-
vcpkg.json | 2 +-
10 files changed, 33 insertions(+), 88 deletions(-)
delete mode 100644 deps/stdexec/portfile.cmake
delete mode 100644 deps/stdexec/vcpkg.json
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 06cdc6e1..886663e5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -16,7 +16,7 @@ on:
- 'CMakePresets.json'
env:
- VCPKG_VERSION: '962e5e39f8a25f42522f51fffc574e05a3efd26b' # Jul 02, 2023
+ VCPKG_VERSION: '000d1bda1ffa95a73e0b40334fa4103d6f4d3d48' # Jul 02, 2023
CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=Release -DVCPKG_MANIFEST_INSTALL=off -DASIO_GRPC_ENABLE_PKGCONFIG_FALLBACK=off -DCMAKE_COMPILE_WARNING_AS_ERROR=on'
CTEST_ARGS: '-T test --output-on-failure --timeout 180 --no-tests=error --parallel 25'
diff --git a/README.md b/README.md
index 00138e53..c48346f8 100644
--- a/README.md
+++ b/README.md
@@ -15,14 +15,14 @@ An [Executor, Networking TS](https://www.boost.org/doc/libs/1_81_0/doc/html/boos
* Support for generic gRPC clients and servers (aka. proxies)
* No extra codegen required, works with the vanilla gRPC C++ plugin (`grpc_cpp_plugin`)
* No-Boost version with [standalone Asio](https://github.com/chriskohlhoff/asio)
-* No-Asio version with [libunifex](https://github.com/facebookexperimental/libunifex)
+* No-Asio version with [libunifex](https://github.com/facebookexperimental/libunifex) or [stdexec](https://github.com/NVIDIA/stdexec)
* CMake function to generate gRPC source files: [asio_grpc_protobuf_generate](/cmake/AsioGrpcProtobufGenerator.cmake)
# Requirements
Asio-grpc is a C++17, header-only library. To install it, CMake (3.14+) is all that is needed.
-To use it, [gRPC](https://grpc.io/) and either [Boost.Asio](https://www.boost.org/doc/libs/1_81_0/doc/html/boost_asio.html) (min. 1.74.0), [standalone Asio](https://github.com/chriskohlhoff/asio) (min. 1.17.0) or [libunifex](https://github.com/facebookexperimental/libunifex) must be present and linked into your application.
+To use it, [gRPC](https://grpc.io/) and either [Boost.Asio](https://www.boost.org/doc/libs/1_81_0/doc/html/boost_asio.html) (min. 1.74.0), [standalone Asio](https://github.com/chriskohlhoff/asio) (min. 1.17.0), [libunifex](https://github.com/facebookexperimental/libunifex) or [stdexec](https://github.com/NVIDIA/stdexec) must be present and linked into your application.
Supported compilers are GCC 8+, Clang 10+, AppleClang 14+ and latest MSVC.
@@ -66,6 +66,15 @@ target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-unifex)
# Also link with the equivalents of gRPC::grpc++ and unifex::unifex
```
+Or using [stdexec](https://github.com/NVIDIA/stdexec):
+
+```cmake
+add_subdirectory(/path/to/asio-grpc)
+target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-stdexec)
+
+# Also link with the equivalents of gRPC::grpc++ and STDEXEC::stdexec
+```
+
@@ -105,6 +114,14 @@ find_package(asio-grpc)
target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-unifex)
```
+Or using [stdexec](https://github.com/NVIDIA/stdexec):
+
+```cmake
+# Make sure CMAKE_PREFIX_PATH contains /desired/installation/directory
+find_package(asio-grpc)
+target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-stdexec)
+```
+
@@ -124,7 +141,9 @@ Add [asio-grpc](https://github.com/microsoft/vcpkg/blob/master/ports/asio-grpc/v
// To use the standalone Asio backend add
// "asio",
// To use the libunifex backend add
- // "libunifex"
+ // "libunifex",
+ // To use the stdexec backend add
+ // "stdexec"
]
}
```
@@ -139,6 +158,8 @@ target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc)
#target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-standalone-asio)
# Or use the libunifex backend
#target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-unifex)
+# Or use the stdexec backend
+#target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc-stdexec)
```
@@ -176,7 +197,7 @@ target_link_libraries(your_app PUBLIC asio-grpc::asio-grpc)
This type of usage is unsupported. Future versions of asio-grpc might break it without notice.
Copy the contents of the `src/` directory into your project and add it to your project's include directories. Depending on your desired backend: Boost.Asio,
-standalone Asio or libunifex, set the preprocessor definitions `AGRPC_BOOST_ASIO`, `AGRPC_STANDALONE_ASIO` or `AGRPC_UNIFEX` respectively. Also make sure that
+standalone Asio, libunifex or stdexec, set the preprocessor definitions `AGRPC_BOOST_ASIO`, `AGRPC_STANDALONE_ASIO`, `AGRPC_UNIFEX` or `AGRPC_STDEXEC` respectively. Also make sure that
the backend's header files and libraries can be found correctly.
diff --git a/deps/stdexec/portfile.cmake b/deps/stdexec/portfile.cmake
deleted file mode 100644
index c96c9bf6..00000000
--- a/deps/stdexec/portfile.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-vcpkg_from_github(
- OUT_SOURCE_PATH
- SOURCE_PATH
- REPO
- NVIDIA/stdexec
- REF
- e05f158445ef957dc53731607d417ec6a7d834d7
- SHA512
- cd7aac8c5af8dcae99bf9d2e06f17f3546a776f479f8ccc6b0f834de1dc43a0d9f2cdfe3da5f115decf8bee7d8c01d2750be23e7ff21b581d5f28f272f21e3e7
- HEAD_REF
- main)
-
-vcpkg_from_github(
- OUT_SOURCE_PATH
- SOURCE_PATH_RAPIDS
- REPO
- rapidsai/rapids-cmake
- REF
- c7a28304639a2ed460181b4753f3280c7833c718
- SHA512
- 9a87fdef490199337778b8c9b4df31ca37d65df23803d058f13b406dcfda4d96d992b2780b0b878b61b027c0dc848351496a0f32e779f95298f259bab040b49b
- HEAD_REF
- main)
-
-vcpkg_download_distfile(
- RAPIDS_cmake
- URLS
- "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.02/RAPIDS.cmake"
- FILENAME
- "RAPIDS.cmake"
- SHA512
- e7830364222a9ea46fe7756859dc8d36e401c720f6a49880a2945a9ebc5bd9aa7e40a8bd382e1cae3af4235d5c9a7998f38331e23b676af7c5c72e7f00e61f0c
-)
-file(COPY "${RAPIDS_cmake}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/")
-
-vcpkg_download_distfile(
- execution_bs
- URLS
- "https://raw.githubusercontent.com/brycelelbach/wg21_p2300_execution/f3f5531362cf6a9207e2e7be6c42e8bee9f41b07/execution.bs"
- FILENAME
- "execution.bs"
- SHA512
- f57fa1f964d18c39ecd4038a35fbeef25a6bba72854d37ed407fc598452c2c91a80e4448fe97566d64fe4853f370fe2215b519d787f85d2649ed3cd0bfe4016f
-)
-file(COPY "${execution_bs}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/")
-
-set(VCPKG_BUILD_TYPE release)
-
-vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DSTDEXEC_BUILD_TESTS=OFF -DSTDEXEC_BUILD_EXAMPLES=OFF
- -DFETCHCONTENT_SOURCE_DIR_RAPIDS-CMAKE="${SOURCE_PATH_RAPIDS}")
-
-vcpkg_cmake_install()
-
-vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/stdexec)
-
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
-
-vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/deps/stdexec/vcpkg.json b/deps/stdexec/vcpkg.json
deleted file mode 100644
index fd3408fe..00000000
--- a/deps/stdexec/vcpkg.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "stdexec",
- "version-date": "2023-12-04",
- "description": "stdexec is an experimental reference implementation of the Senders model of asynchronous programming proposed by P2300 - std::execution for adoption into the C++ Standard.",
- "homepage": "https://github.com/NVIDIA/stdexec",
- "license": "Apache-2.0",
- "dependencies": [
- {
- "name": "vcpkg-cmake",
- "host": true
- },
- {
- "name": "vcpkg-cmake-config",
- "host": true
- }
- ]
-}
diff --git a/src/agrpc/detail/manual_reset_event.hpp b/src/agrpc/detail/manual_reset_event.hpp
index 4266e788..efa12dc8 100644
--- a/src/agrpc/detail/manual_reset_event.hpp
+++ b/src/agrpc/detail/manual_reset_event.hpp
@@ -245,8 +245,7 @@ class ManualResetEventOperationState
state.complete();
return;
}
- auto stop_token = exec::get_stop_token(state.receiver());
- if (detail::stop_requested(stop_token))
+ if (auto stop_token = exec::get_stop_token(state.receiver()); detail::stop_requested(stop_token))
{
exec::set_done(static_cast(state.receiver()));
return;
diff --git a/src/agrpc/detail/register_sender_rpc_handler.hpp b/src/agrpc/detail/register_sender_rpc_handler.hpp
index e0dae8f6..df0884f3 100644
--- a/src/agrpc/detail/register_sender_rpc_handler.hpp
+++ b/src/agrpc/detail/register_sender_rpc_handler.hpp
@@ -159,7 +159,7 @@ struct RPCHandlerOperation
struct StartReceiver
{
#ifdef AGRPC_STDEXEC
- using receiver_concept = stdexec::receiver_t;
+ using is_receiver = void;
#endif
RPCHandlerOperation& rpc_handler_op_;
@@ -209,7 +209,7 @@ struct RPCHandlerOperation
struct Receiver
{
#ifdef AGRPC_STDEXEC
- using receiver_concept = stdexec::receiver_t;
+ using is_receiver = void;
#endif
RPCHandlerOperation& op_;
diff --git a/src/agrpc/detail/sender_of.hpp b/src/agrpc/detail/sender_of.hpp
index 7f8bf969..ba432841 100644
--- a/src/agrpc/detail/sender_of.hpp
+++ b/src/agrpc/detail/sender_of.hpp
@@ -39,7 +39,7 @@ struct SenderOf
static constexpr bool sends_done = true;
#ifdef AGRPC_STDEXEC
- using sender_concept = stdexec::sender_t;
+ using is_sender = void;
using completion_signatures =
stdexec::completion_signatures