Skip to content

Commit deb7ddf

Browse files
committed
chore: relocate sources and add build presets
- move implementation sources under src/corosio/src and adjust build files - add CMakePresets.json default Ninja configure to out/build - note portable capy::cond comparisons in docs and public API comments - refresh ignore rules to keep build scripts while ignoring outputs
1 parent 409da97 commit deb7ddf

32 files changed

Lines changed: 48 additions & 20 deletions

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/build-*/
2-
/bin64/
3-
.cache/
4-
/output/
5-
/.temp
1+
/.vscode/
2+
/build/
3+
!/build/Jamfile
4+
!/build/wolfssl.jam
5+
/out/
6+
CMakeUserPresets.json

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,19 @@ file(GLOB_RECURSE BOOST_COROSIO_HEADERS CONFIGURE_DEPENDS
130130
"${CMAKE_CURRENT_SOURCE_DIR}/include/boost/corosio/*.hpp"
131131
"${CMAKE_CURRENT_SOURCE_DIR}/include/boost/corosio.hpp")
132132
file(GLOB_RECURSE BOOST_COROSIO_SOURCES CONFIGURE_DEPENDS
133-
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp"
134-
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
133+
"${CMAKE_CURRENT_SOURCE_DIR}/src/corosio/src/*.hpp"
134+
"${CMAKE_CURRENT_SOURCE_DIR}/src/corosio/src/*.cpp")
135135

136136
source_group("" FILES "include/boost/corosio.hpp")
137137
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/include/boost/corosio" PREFIX "include" FILES ${BOOST_COROSIO_HEADERS})
138-
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "src" FILES ${BOOST_COROSIO_SOURCES})
138+
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src/corosio/src" PREFIX "src" FILES ${BOOST_COROSIO_SOURCES})
139139

140140
function(boost_corosio_setup_properties target)
141141
target_compile_features(${target} PUBLIC cxx_std_20)
142142
target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include")
143-
target_include_directories(${target} PRIVATE "${PROJECT_SOURCE_DIR}/src")
143+
target_include_directories(${target} PRIVATE
144+
"${PROJECT_SOURCE_DIR}/src/corosio"
145+
"${PROJECT_SOURCE_DIR}/src/corosio/src")
144146
target_link_libraries(${target}
145147
PUBLIC
146148
${BOOST_COROSIO_DEPENDENCIES}

CMakePresets.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 8,
3+
"configurePresets": [
4+
{
5+
"name": "Custom configure preset",
6+
"displayName": "Custom configure preset",
7+
"description": "Sets Ninja generator, build and install directory",
8+
"generator": "Ninja",
9+
"binaryDir": "${sourceDir}/out/build/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_BUILD_TYPE": "Debug",
12+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
13+
}
14+
}
15+
]
16+
}

build/Jamfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project boost/corosio
3131
: source-location $(COROSIO_ROOT)
3232
;
3333

34-
alias corosio_sources : [ glob-tree-ex $(COROSIO_ROOT)/src/src : *.cpp ] ;
34+
alias corosio_sources : [ glob-tree-ex $(COROSIO_ROOT)/src/corosio/src : *.cpp ] ;
3535

3636
lib boost_corosio
3737
: corosio_sources
@@ -41,7 +41,8 @@ lib boost_corosio
4141
<library>/boost/system//boost_system
4242
<target-os>windows:<library>ws2_32
4343
<include>$(COROSIO_ROOT)/include
44-
<include>$(COROSIO_ROOT)/src
44+
<include>$(COROSIO_ROOT)/src/corosio
45+
<include>$(COROSIO_ROOT)/src/corosio/src
4546
: usage-requirements
4647
<library>/boost/capy//boost_capy
4748
<library>/boost/url//boost_url

doc/modules/ROOT/pages/io/acceptor.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ capy::task<void> accept_loop(corosio::io_context& ioc)
115115
116116
if (ec)
117117
{
118-
if (ec == boost::system::errc::operation_canceled)
118+
if (ec == capy::cond::canceled)
119119
break; // Acceptor was closed
120120
std::cerr << "Accept error: " << ec.message() << "\n";
121121
continue;

doc/modules/ROOT/pages/io/sockets.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ auto [ec, n] = co_await s.read_some(
9494
9595
if (ec)
9696
{
97-
if (ec == capy::error::eof)
97+
if (ec == capy::cond::eof)
9898
std::cout << "Peer closed connection\n";
9999
else
100100
std::cerr << "Read error: " << ec.message() << "\n";
@@ -213,11 +213,11 @@ auto [ec, n] = co_await s.read_some(buf);
213213
214214
if (ec)
215215
{
216-
if (ec == capy::error::eof)
216+
if (ec == capy::cond::eof)
217217
{
218218
// Normal disconnect (end of stream)
219219
}
220-
else if (ec == boost::system::errc::operation_canceled)
220+
else if (ec == capy::cond::canceled)
221221
{
222222
// We called cancel()
223223
}

include/boost/corosio/acceptor.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ class acceptor : public io_object
239239
@return An awaitable that completes with `io_result<>`.
240240
Returns success on successful accept, or an error code on
241241
failure including:
242-
- operation_canceled: Cancelled via stop_token or cancel()
242+
- operation_canceled: Cancelled via stop_token or cancel().
243+
Check `ec == cond::canceled` for portable comparison.
243244
244245
@par Preconditions
245246
The acceptor must be listening (`is_open() == true`).
@@ -263,6 +264,7 @@ class acceptor : public io_object
263264
/** Cancel any pending asynchronous operations.
264265
265266
All outstanding operations complete with `errc::operation_canceled`.
267+
Check `ec == cond::canceled` for portable comparison.
266268
*/
267269
BOOST_COROSIO_DECL
268270
void cancel();

include/boost/corosio/io_stream.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class io_stream : public io_object
4343
@return An awaitable that completes with a pair of
4444
`{error_code, bytes_transferred}`. Returns success with the
4545
number of bytes read, or an error code on failure including:
46-
- capy::error::eof: End of stream reached
47-
- operation_canceled: Cancelled via stop_token or cancel()
46+
- capy::error::eof: End of stream reached.
47+
Check `ec == cond::eof` for portable comparison.
48+
- operation_canceled: Cancelled via stop_token or cancel().
49+
Check `ec == cond::canceled` for portable comparison.
4850
4951
@par Preconditions
5052
The socket must be open and connected.
@@ -75,7 +77,8 @@ class io_stream : public io_object
7577
`{error_code, bytes_transferred}`. Returns success with the
7678
number of bytes written, or an error code on failure including:
7779
- broken_pipe: Connection closed by peer
78-
- operation_canceled: Cancelled via stop_token or cancel()
80+
- operation_canceled: Cancelled via stop_token or cancel().
81+
Check `ec == cond::canceled` for portable comparison.
7982
8083
@par Preconditions
8184
The socket must be open and connected.

include/boost/corosio/resolver.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ class resolver : public io_object
312312
/** Cancel any pending asynchronous operations.
313313
314314
All outstanding operations complete with `errc::operation_canceled`.
315+
Check `ec == cond::canceled` for portable comparison.
315316
*/
316317
BOOST_COROSIO_DECL
317318
void cancel();

include/boost/corosio/socket.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ class socket : public io_stream
245245
- connection_refused: No server listening at endpoint
246246
- timed_out: Connection attempt timed out
247247
- network_unreachable: No route to host
248-
- operation_canceled: Cancelled via stop_token or cancel()
248+
- operation_canceled: Cancelled via stop_token or cancel().
249+
Check `ec == cond::canceled` for portable comparison.
249250
250251
@par Preconditions
251252
The socket must be open (`is_open() == true`).
@@ -269,6 +270,7 @@ class socket : public io_stream
269270
/** Cancel any pending asynchronous operations.
270271
271272
All outstanding operations complete with `errc::operation_canceled`.
273+
Check `ec == cond::canceled` for portable comparison.
272274
*/
273275
BOOST_COROSIO_DECL
274276
void cancel();

0 commit comments

Comments
 (0)