Skip to content

asioexec::completion_token & ::use_sender #1503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
-DCMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" \
-DSTDEXEC_ENABLE_TBB:BOOL=${{ !contains(matrix.cxxflags, '-fsanitize') }} \
-DSTDEXEC_ENABLE_ASIO:BOOL=TRUE \
-DSTDEXEC_ASIO_IMPLEMENTATION:STRING=boost \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only test in CI with Boost.Asio?

;

# Compile
Expand Down Expand Up @@ -148,6 +150,8 @@ jobs:
cmake -S. -Bbuild -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DSTDEXEC_ENABLE_ASIO:BOOL=TRUE \
-DSTDEXEC_ASIO_IMPLEMENTATION:STRING=boost \
-DCMAKE_CXX_STANDARD=20
cmake --build build/ -v
cd build
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ if (Test-Path -PathType Container $BuildDirectory) {
}
New-Item -ItemType Directory $BuildDirectory | Out-Null

Invoke-NativeCommand cmake -B $BuildDirectory -G Ninja "-DCMAKE_BUILD_TYPE=$Config" "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT:STRING=Embedded" .
Invoke-NativeCommand cmake -B $BuildDirectory -G Ninja `
"-DCMAKE_BUILD_TYPE=$Config" `
"-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT:STRING=Embedded" `
"-DSTDEXEC_ENABLE_ASIO:BOOL=TRUE" `
"-DSTDEXEC_ASIO_IMPLEMENTATION:STRING=boost" .
Invoke-NativeCommand cmake --build $BuildDirectory
Invoke-NativeCommand ctest --test-dir $BuildDirectory
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ callgrind.*
a.out
*.code-workspace
sanitizer-ignorelist.txt
/include/asioexec/asio_config.hpp
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@ if(STDEXEC_ENABLE_ASIO)
set(STDEXEC_ASIO_CONFIG_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/execpools/asio)
configure_file(include/execpools/asio/asio_config.hpp.in ${STDEXEC_ASIO_CONFIG_FILE_PATH}/asio_config.hpp)

set(ASIOEXEC_USES_BOOST ${STDEXEC_ASIO_USES_BOOST})
set(ASIOEXEC_USES_STANDALONE ${STDEXEC_ASIO_USES_STANDALONE})

file(GLOB_RECURSE asioexec_sources include/asioexec/*.hpp)
set(ASIOEXEC_ASIO_CONFIG_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/asioexec)
configure_file(include/asioexec/asio_config.hpp.in ${ASIOEXEC_ASIO_CONFIG_FILE_PATH}/asio_config.hpp)

if(${STDEXEC_ASIO_USES_BOOST})
set(BOOST_ENABLE_COMPATIBILITY_TARGETS TRUE)
rapids_cpm_find(Boost 1.86.0
Expand All @@ -449,6 +456,16 @@ if(STDEXEC_ENABLE_ASIO)
STDEXEC::stdexec
Boost::boost
)

add_library(asioexec_boost INTERFACE ${asioexec_sources})
list(APPEND stdexec_export_targets asioexec_boost)
add_library(STDEXEC::asioexec_boost ALIAS asioexec_boost)

target_link_libraries(asioexec_boost
INTERFACE
STDEXEC::stdexec
Boost::boost
)
elseif(${STDEXEC_ASIO_USES_STANDALONE})
include(cmake/import_standalone_asio.cmake)
import_standalone_asio(
Expand All @@ -464,6 +481,16 @@ if(STDEXEC_ENABLE_ASIO)
STDEXEC::stdexec
asio
)

add_library(asioexec_asio INTERFACE ${asioexec_sources})
list(APPEND stdexec_export_targets asioexec_asio)
add_library(STDEXEC::asioexec_asio ALIAS asioexec_asio)

target_link_libraries(asioexec_asio
INTERFACE
STDEXEC::stdexec
asio
)
else()
message(FATAL_ERROR "ASIO implementation is not configured")
endif()
Expand Down
50 changes: 50 additions & 0 deletions include/asioexec/asio_config.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2025 Robert Leahy. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#cmakedefine01 ASIOEXEC_USES_STANDALONE
#cmakedefine01 ASIOEXEC_USES_BOOST

#if ASIOEXEC_USES_BOOST
# include <boost/asio.hpp>
# include <boost/system/errc.hpp>
# include <boost/system/error_code.hpp>
# include <boost/system/system_error.hpp>
# define ASIOEXEC_ASIO_NAMESPACE boost::asio
#elif ASIOEXEC_USES_STANDALONE
# include <system_error>
# include <asio.hpp>
# define ASIOEXEC_ASIO_NAMESPACE asio
#endif

namespace asioexec {
#if ASIOEXEC_USES_BOOST
namespace asio_impl = ::boost::asio;
using error_code = ::boost::system::error_code;
using error_condition = ::boost::system::error_condition;
namespace errc = ::boost::system::errc;
using system_error = ::boost::system::system_error;
#elif ASIOEXEC_USES_STANDALONE
namespace asio_impl = ::asio;
using error_code = std::error_code;
using error_condition = std::error_condition;
using errc = std::errc;
using system_error = std::system_error;
#endif
}
Loading
Loading