Skip to content

Commit

Permalink
Merge pull request #406 from redboltz/add_coro_broker5
Browse files Browse the repository at this point in the history
Added C++20 coroutine broker.
  • Loading branch information
redboltz authored Mar 1, 2025
2 parents 7b9b067 + 4d16565 commit 1d9356d
Show file tree
Hide file tree
Showing 6 changed files with 3,943 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
= History

== 10.0.1 (undetermined)
* Added C++20 coroutine version of broker (experimental). #406
* Fixed connection status updating timing. #402
* Refined CI. #401
* Refined log level. #399, #402
Expand Down
68 changes: 50 additions & 18 deletions tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ list(APPEND exec_PROGRAMS
client_cli.cpp
)

if("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(CMAKE_CXX_STANDARD 20)
message(STATUS "C++20 tools added")
list(APPEND exec_PROGRAMS
cpp20coro_broker.cpp
)
endif()

find_package(Boost 1.82.0 REQUIRED COMPONENTS program_options)

# Without this setting added, azure pipelines completely fails to find the boost libraries. No idea why.
Expand Down Expand Up @@ -58,29 +66,53 @@ endforeach()

# Separate compiled broker
if(ASYNC_MQTT_BUILD_LIB)

add_executable(broker_separate broker.cpp)
add_dependencies(broker_separate async_mqtt_asio_bind async_mqtt_protocol)
target_compile_definitions(broker_separate PRIVATE ASYNC_MQTT_SEPARATE_COMPILATION)
target_include_directories(broker_separate PRIVATE include ${Boost_INCLUDE_DIRS})
target_link_libraries(broker_separate async_mqtt_iface async_mqtt_asio_bind async_mqtt_protocol)
if(ASYNC_MQTT_USE_LOG)
add_executable(broker_separate broker.cpp)
add_dependencies(broker_separate async_mqtt_asio_bind async_mqtt_protocol)
target_compile_definitions(broker_separate PRIVATE ASYNC_MQTT_SEPARATE_COMPILATION)
target_include_directories(broker_separate PRIVATE include ${Boost_INCLUDE_DIRS})
target_link_libraries(broker_separate async_mqtt_iface async_mqtt_asio_bind async_mqtt_protocol)
if(ASYNC_MQTT_USE_LOG)
target_compile_definitions(
broker_separate
PUBLIC
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_LOG_DYN_LINK>
)
target_link_libraries(
broker_separate Boost::log
)
endif()
target_compile_definitions(
broker_separate
PUBLIC
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_LOG_DYN_LINK>
)
target_link_libraries(
broker_separate Boost::log
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_PROGRAM_OPTIONS_DYN_LINK>
)
endif()
target_compile_definitions(
broker_separate
PUBLIC
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_PROGRAM_OPTIONS_DYN_LINK>
)
target_link_libraries(broker_separate Boost::program_options)
target_link_libraries(broker_separate Boost::program_options)

if("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(CMAKE_CXX_STANDARD 20)
message(STATUS "C++20 separate broker added")
add_executable(cpp20coro_broker_separate cpp20coro_broker.cpp)
add_dependencies(cpp20coro_broker_separate async_mqtt_asio_bind async_mqtt_protocol)
target_compile_definitions(cpp20coro_broker_separate PRIVATE ASYNC_MQTT_SEPARATE_COMPILATION)
target_include_directories(cpp20coro_broker_separate PRIVATE include ${Boost_INCLUDE_DIRS})
target_link_libraries(cpp20coro_broker_separate async_mqtt_iface async_mqtt_asio_bind async_mqtt_protocol)
if(ASYNC_MQTT_USE_LOG)
target_compile_definitions(
cpp20coro_broker_separate
PUBLIC
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_LOG_DYN_LINK>
)
target_link_libraries(
cpp20coro_broker_separate Boost::log
)
endif()
target_compile_definitions(
cpp20coro_broker_separate
PUBLIC
$<IF:$<BOOL:${ASYNC_MQTT_USE_STATIC_BOOST}>,,BOOST_PROGRAM_OPTIONS_DYN_LINK>
)
target_link_libraries(cpp20coro_broker_separate Boost::program_options)
endif()
endif()

if(UNIX)
Expand Down
Loading

0 comments on commit 1d9356d

Please # to comment.