Skip to content

Commit

Permalink
Added define for examples to be build
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-kozarec committed Mar 24, 2024
1 parent 32864a1 commit f72916f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ project(libio VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 20)

add_subdirectory(libs/libio)

if(BUILD_EXAMPLES)
add_subdirectory(examples/websocket_example)
endif()
10 changes: 1 addition & 9 deletions examples/websocket_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
cmake_minimum_required(VERSION 3.15)
project(websocket_example)

set(CMAKE_CXX_STANDARD 20)

find_package(libio REQUIRED)
find_package(Boost COMPONENTS system log REQUIRED)
find_package(OpenSSL REQUIRED)

add_executable(websocket_example src/main.cpp)

target_link_libraries(websocket_example PRIVATE ${LIBIO_LIBRARIES})
target_compile_options(websocket_example PRIVATE "-fcoroutines")
target_link_libraries(websocket_example PRIVATE io)
2 changes: 1 addition & 1 deletion libs/libio/include/endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace io::priv
virtual boost::asio::awaitable<bool> connect() noexcept = 0;
virtual boost::asio::awaitable<bool> disconnect() noexcept = 0;

virtual boost::asio::awaitable<void> write(const std::string &message) = 0;
virtual boost::asio::awaitable<void> write(const std::string & message) = 0;
virtual boost::asio::awaitable<std::string> read() = 0;

void set_host(const std::string & host);
Expand Down
2 changes: 1 addition & 1 deletion libs/libio/src/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ boost::asio::awaitable<void> io::Websocket::listen()
for (;;)
{
const auto result = co_await impl_->endpoint.read();

if (const auto observer = impl_->observer.lock())
{
co_await observer->on_recieved(result);
Expand Down

0 comments on commit f72916f

Please sign in to comment.