Skip to content

Commit 9fb511c

Browse files
[io] cmake test.
1 parent f243c84 commit 9fb511c

20 files changed

+58
-35
lines changed

CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,34 @@ if (NOT BOOST_COBALT_IS_ROOT)
7676
endif()
7777

7878
if(BUILD_SHARED_LIBS)
79-
target_compile_definitions(boost_cobalt PUBLIC BOOST_COBALT_DYN_LINK)
79+
target_compile_definitions(boost_cobalt PUBLIC BOOST_COBALT_DYN_LINK=1)
8080
else()
81-
target_compile_definitions(boost_cobalt PUBLIC BOOST_COBALT_STATIC_LINK)
81+
target_compile_definitions(boost_cobalt PUBLIC BOOST_COBALT_STATIC_LINK=1)
8282
endif()
8383

84+
add_library(boost_cobalt_io
85+
src/io/steady_timer.cpp
86+
src/io/system_timer.cpp
87+
src/io/signal_set.cpp
88+
src/io/sleep.cpp
89+
src/io/read.cpp
90+
src/io/write.cpp
91+
src/io/serial_port.cpp
92+
src/io/pipe.cpp
93+
src/io/file.cpp
94+
src/io/random_access_file.cpp
95+
src/io/stream_file.cpp
96+
src/io/endpoint.cpp
97+
src/io/socket.cpp
98+
src/io/datagram_socket.cpp
99+
src/io/seq_packet_socket.cpp
100+
src/io/stream_socket.cpp
101+
)
102+
103+
target_link_libraries(boost_cobalt_io PUBLIC boost_cobalt)
104+
target_compile_definitions(boost_cobalt_io PRIVATE BOOST_COBALT_IO_SOURCE=1)
105+
add_library(Boost::cobalt::io ALIAS boost_cobalt_io)
106+
84107
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
85108
add_subdirectory(test)
86109
endif()
@@ -192,7 +215,7 @@ else()
192215
add_library(Boost::cobalt::io ALIAS boost_cobalt_io)
193216

194217
if(BOOST_COBALT_INSTALL AND NOT BOOST_SUPERPROJECT_VERSION)
195-
install(TARGETS boost_cobalt
218+
install(TARGETS boost_cobalt boost_cobalt_io
196219
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
197220
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
198221
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"

doc/reference/io/serial_port.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct serial_port
4343
[[nodiscard]] system::result<void> set_parity(parity rate);
4444
[[nodiscard]] system::result<parity> get_parity();
4545
46-
[[nodiscard]] BOOST_COBALT_IO_DECL system::result<void> assign(native_handle_type native_handle);
46+
[[nodiscard]] system::result<void> assign(native_handle_type native_handle);
4747
4848
[[nodiscard]] system::result<void> open(std::string_view device);
4949

include/boost/cobalt/io/datagram_socket.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace boost::cobalt::io
1818
{
1919

20-
struct [[nodiscard]] datagram_socket final : socket
20+
struct BOOST_SYMBOL_VISIBLE datagram_socket final : socket
2121
{
2222
BOOST_COBALT_IO_DECL datagram_socket(const cobalt::executor & executor = this_thread::get_executor());
2323
BOOST_COBALT_IO_DECL datagram_socket(datagram_socket && lhs);

include/boost/cobalt/io/endpoint.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ const ip_address_v6* tag_invoke(get_endpoint_tag<AF_INET6>,
339339
const endpoint::addr_type * addr);
340340

341341

342-
struct ip_address
342+
struct BOOST_SYMBOL_VISIBLE ip_address
343343
{
344344

345345
bool is_ipv6() const { return addr_.ss_family == BOOST_ASIO_OS_DEF(AF_INET6); }

include/boost/cobalt/io/file.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace boost::cobalt::io
2424
{
2525

26-
struct file
26+
struct BOOST_SYMBOL_VISIBLE file
2727
#if defined(BOOST_ASIO_HAS_FILE)
2828
: asio::file_base
2929
#endif

include/boost/cobalt/io/pipe.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ system::result<std::pair<struct readable_pipe, struct writable_pipe>> pipe(
2929
);
3030

3131

32-
struct readable_pipe final : read_stream
32+
struct BOOST_SYMBOL_VISIBLE readable_pipe final : read_stream
3333
{
3434
using native_handle_type = asio::basic_readable_pipe<executor>::native_handle_type;
3535

@@ -63,7 +63,7 @@ struct readable_pipe final : read_stream
6363
};
6464

6565

66-
struct writable_pipe final : write_stream
66+
struct BOOST_SYMBOL_VISIBLE writable_pipe final : write_stream
6767
{
6868
using native_handle_type = asio::basic_writable_pipe<executor>::native_handle_type;
6969

include/boost/cobalt/io/random_access_device.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace boost::cobalt::io
1515
{
1616

1717
// tag::outline[]
18-
struct random_access_write_device
18+
struct BOOST_SYMBOL_VISIBLE random_access_write_device
1919
{
2020
virtual ~random_access_write_device() = default;
2121
[[nodiscard]] virtual write_at_op write_some_at(std::uint64_t offset, const_buffer_sequence buffer) = 0;
2222
};
2323

24-
struct random_access_read_device
24+
struct BOOST_SYMBOL_VISIBLE random_access_read_device
2525
{
2626
virtual ~random_access_read_device() = default;
2727
[[nodiscard]] virtual read_at_op read_some_at(std::uint64_t offset, mutable_buffer_sequence buffer) = 0;

include/boost/cobalt/io/random_access_file.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace boost::cobalt::io
2222
{
2323

2424

25-
struct random_access_file : file, random_access_device
25+
struct BOOST_SYMBOL_VISIBLE random_access_file : file, random_access_device
2626
{
2727
using native_handle_type = file::native_handle_type;
2828

include/boost/cobalt/io/read.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace boost::cobalt::io
1717
{
1818

19-
struct BOOST_COBALT_IO_DECL read_all final : op<system::error_code, std::size_t>
19+
struct BOOST_SYMBOL_VISIBLE read_all final : op<system::error_code, std::size_t>
2020
{
2121
read_op step;
2222
read_all(read_op op) : step(op) {}
@@ -35,7 +35,7 @@ template<typename Stream>
3535
}
3636

3737

38-
struct BOOST_COBALT_IO_DECL read_all_at final : op<system::error_code, std::size_t>
38+
struct BOOST_SYMBOL_VISIBLE read_all_at final : op<system::error_code, std::size_t>
3939
{
4040
read_at_op step;
4141
read_all_at(read_at_op op) : step(op) {}

include/boost/cobalt/io/seq_packet_socket.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace boost::cobalt::io
1818
{
1919

20-
struct [[nodiscard]] seq_packet_socket final : socket
20+
struct BOOST_SYMBOL_VISIBLE seq_packet_socket final : socket
2121
{
2222
BOOST_COBALT_IO_DECL seq_packet_socket(const cobalt::executor & executor = this_thread::get_executor());
2323
BOOST_COBALT_IO_DECL seq_packet_socket(seq_packet_socket && lhs);

0 commit comments

Comments
 (0)