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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
40 changes: 40 additions & 0 deletions include/asioexec/asio_config.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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