forked from boostorg/mqtt5
Add Windows builds to CI
Summary: related to T15996 Reviewers: ivica Reviewed By: ivica Subscribers: iljazovic, miljen Differential Revision: https://repo.mireo.local/D33712
This commit is contained in:
@ -5,13 +5,11 @@
|
||||
# (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
|
||||
name: CI
|
||||
name: CI-posix
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
# TODO: windows builds
|
||||
|
||||
posix-cmake:
|
||||
name: "CMake ${{ matrix.toolset }} std=c++${{ matrix.cxxstd }} ${{ matrix.cxxflags }}"
|
||||
defaults:
|
182
.github/workflows/ci-windows.yml
vendored
Normal file
182
.github/workflows/ci-windows.yml
vendored
Normal file
@ -0,0 +1,182 @@
|
||||
#
|
||||
# Copyright (c) 2023-2024 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
|
||||
name: CI-Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
windows-cmake:
|
||||
name: "CMake ${{ matrix.toolset }} ${{ matrix.architecture }} std=c++${{ matrix.cxxstd }}"
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- toolset: msvc-14.3
|
||||
os: windows-2022
|
||||
architecture: Win32
|
||||
generator: Visual Studio 17 2022
|
||||
cxxstd: 20
|
||||
build-type: 'Debug'
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
- toolset: msvc-14.3
|
||||
os: windows-2022
|
||||
architecture: x64
|
||||
generator: Visual Studio 17 2022
|
||||
cxxstd: 20
|
||||
build-type: 'Debug'
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CXXFLAGS: ${{ matrix.cxxflags }} /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN=1 /DNOMINMAX=1 /D_FILE_OFFSET_BITS=64 /DBOOST_ALL_NO_LIB /EHsc /bigobj
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: 4
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup OpenSSL
|
||||
env:
|
||||
OPENSSL_ROOT: "C:\\OpenSSL"
|
||||
run: |
|
||||
if "${{ matrix.architecture }}" == "x64" (
|
||||
choco install --no-progress -y openssl --x64
|
||||
)
|
||||
if "${{ matrix.architecture }}" == "Win32" (
|
||||
set openssl_install_dir="C:\\Program Files (x86)\\OpenSSL-Win32"
|
||||
choco install --no-progress -y openssl --forcex86 --version 1.1.1.2100
|
||||
)
|
||||
if "${{ matrix.architecture }}" == "x64" (
|
||||
if exist "C:\Program Files\OpenSSL\" (
|
||||
set openssl_install_dir="C:\\Program Files\\OpenSSL"
|
||||
) else (
|
||||
set openssl_install_dir="C:\\Program Files\\OpenSSL-Win64"
|
||||
)
|
||||
)
|
||||
mklink /D %OPENSSL_ROOT% %openssl_install_dir%
|
||||
refreshenv
|
||||
set
|
||||
|
||||
- name: Setup CMake
|
||||
run: choco install cmake
|
||||
|
||||
- name: Setup Boost
|
||||
run: python3 tools/ci.py setup-boost --source-dir=%cd%
|
||||
|
||||
- name: Build a Boost distribution using B2
|
||||
run : |
|
||||
python3 tools/ci.py build-b2-distro ^
|
||||
--toolset ${{ matrix.toolset }}
|
||||
|
||||
- name: Build a Boost distribution using CMake
|
||||
run: |
|
||||
python3 tools/ci.py build-cmake-distro ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
- name: Build standalone examples using CMake
|
||||
run: |
|
||||
python3 tools/ci.py build-cmake-standalone-examples ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
- name: Build standalone tests using CMake
|
||||
run: |
|
||||
python3 tools/ci.py build-cmake-standalone-tests ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
- name: Run standalone tests
|
||||
run: |
|
||||
python3 tools/ci.py run-cmake-standalone-tests ^
|
||||
--build-type ${{ matrix.build-type }}
|
||||
|
||||
- name: Run CMake find_package test with B2 distribution
|
||||
run: |
|
||||
python3 tools/ci.py run-cmake-b2-find-package-tests ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
- name: Run CMake find_package test with CMake distribution
|
||||
run: |
|
||||
python3 tools/ci.py run-cmake-find-package-tests ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
- name: Run CMake add_subdirectory test with CMake distribution
|
||||
run: |
|
||||
python3 tools/ci.py run-cmake-add-subdirectory-tests ^
|
||||
--build-type ${{ matrix.build-type }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--generator "${{ matrix.generator }}"
|
||||
|
||||
windows-b2:
|
||||
name: "B2 ${{ matrix.toolset }} ${{ matrix.architecture }} std=c++${{ matrix.cxxstd }}"
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- toolset: msvc-14.3
|
||||
os: windows-2022
|
||||
architecture: Win32
|
||||
generator: Visual Studio 17 2022
|
||||
cxxstd: "17,20"
|
||||
build-type: 'release'
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
- toolset: msvc-14.3
|
||||
os: windows-2022
|
||||
architecture: x64
|
||||
generator: Visual Studio 17 2022
|
||||
cxxstd: "17,20"
|
||||
build-type: 'release'
|
||||
cxxflags: ''
|
||||
ldflags: ''
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CXXFLAGS: ${{ matrix.cxxflags }} /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN=1 /DNOMINMAX=1 /D_FILE_OFFSET_BITS=64 /DBOOST_ALL_NO_LIB /EHsc /bigobj
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Boost
|
||||
run: python3 tools/ci.py setup-boost --source-dir=%cd%
|
||||
|
||||
- name: Build and run project tests using B2
|
||||
run: |
|
||||
python3 tools/ci.py run-b2-tests ^
|
||||
--toolset ${{ matrix.toolset }} ^
|
||||
--cxxstd ${{ matrix.cxxstd }} ^
|
||||
--variant ${{ matrix.build-type }}
|
15
README.md
15
README.md
@ -1,22 +1,19 @@
|
||||
Boost.MQTT5: A C++17 MQTT client based on Boost.Asio
|
||||
===============================
|
||||
|
||||
Branch | Windows/Linux Build | Coverage | Documentation |
|
||||
-------|---------------------|----------|---------------|
|
||||
[`master`](https://github.com/mireo/async-mqtt5/tree/master) | [](https://github.com/mireo/async-mqtt5/actions/workflows/ci.yml) | [](https://codecov.io/gh/mireo/async-mqtt5/branch/master) | [documentation](https://spacetime.mireo.com/async-mqtt5/)
|
||||
[`develop`](https://github.com/mireo/async-mqtt5/tree/develop) | [](https://github.com/mireo/async-mqtt5/actions/workflows/ci.yml) | [](https://codecov.io/gh/mireo/async-mqtt5/branch/develop) |
|
||||
Branch | Linux Build | Windows Build | Coverage | Documentation |
|
||||
-------|-------------|---------------|----------|---------------|
|
||||
[`master`](https://github.com/boostorg/mqtt5/tree/master) | [](https://github.com/boostorg/mqtt5/actions/workflows/ci-posix.yml) | [](https://github.com/boostorg/mqtt5/actions/workflows/ci-windows.yml) | [](https://codecov.io/gh/mireo/async-mqtt5/tree/master) | [documentation](https://www.boost.org/doc/libs/master/libs/mqtt5/doc/html/index.html)
|
||||
[`develop`](https://github.com/boostorg/mqtt5/tree/develop) | [](https://github.com/boostorg/mqtt5/actions/workflows/ci-posix.yml) | [](https://github.com/boostorg/mqtt5/actions/workflows/ci-windows.yml) | [](https://codecov.io/gh/mireo/async-mqtt5/tree/develop) | [documentation](https://www.boost.org/doc/libs/develop/libs/mqtt5/doc/html/index.html)
|
||||
|
||||
Boost.MQTT5 is a professional, industrial-grade C++17 client built on [Boost.Asio](https://www.boost.org/doc/libs/1_82_0/doc/html/boost_asio.html). This Client is designed for publishing or receiving messages from an MQTT 5.0 compatible Broker. Boost.MQTT5 represents a comprehensive implementation of the MQTT 5.0 protocol standard, offering full support for publishing or receiving messages with QoS 0, 1, and 2.
|
||||
|
||||
~~Our clear intention is to include the Boost.MQTT5 library into [Boost](https://www.boost.org/). We are actively working on it.~~\
|
||||
As of October 2024, the Boost.MQTT5 library has been **conditionally ACCEPTED** into [Boost](https://www.boost.org/).
|
||||
Boost.MQTT5 is a professional, industrial-grade C++17 client built on [Boost.Asio](https://www.boost.org/doc/libs/master/doc/html/boost_asio.html). This Client is designed for publishing or receiving messages from an MQTT 5.0 compatible Broker. Boost.MQTT5 represents a comprehensive implementation of the MQTT 5.0 protocol standard, offering full support for publishing or receiving messages with QoS 0, 1, and 2.
|
||||
|
||||
Motivation
|
||||
---------
|
||||
The [MQTT](https://mqtt.org/) protocol is widely used for communication in various real-world scenarios, primarily as a reliable communication protocol for data transfer to and from IoT devices. While the MQTT protocol is relatively straightforward, integrating it into an application can be complex, primarily due to the challenging implementation of message retransmission after a disconnect/reconnect sequence. To address these challenges and simplify MQTT integration once and for all, Boost.MQTT5 was designed with the following core objectives in mind:
|
||||
|
||||
Objective | Description |
|
||||
----------|---------|
|
||||
----------|-------------|
|
||||
"Plug and play" interface that abstracts away MQTT protocol internals, low-level network events, message retransmission and other complexities | Enables developers to publish or receive messages with just a single line of code, significantly reducing the learning curve and development time. Getting started requires basic MQTT knowledge, making the library accessible to developers of all skill levels. |
|
||||
Highly reliable and robust Client that handles network losses, unreliable data transport, network latencies, and other unpredictable events | The Client does not expose connect functions (nor asynchronous connect functions); instead, network connectivity, MQTT handshake, and message retransmission are automatically handled within the Client while strictly adhering to the MQTT specification. This automation eliminates the need for developers to write extensive and error-prone code to handle these scenarios, allowing them to focus on the application's core functionality. |
|
||||
Complete adherence to the Boost.Asio's universal asynchronous model | The interfaces and implementation strategies are built upon the foundations of Boost.Asio. This compatibility enables seamless integration with any other library within the Boost.Asio ecosystem. |
|
||||
|
@ -40,15 +40,19 @@ public:
|
||||
using executor_type = typename stream_type::executor_type;
|
||||
using logger_type = LoggerType;
|
||||
private:
|
||||
using async_mutex = boost::mqtt5::detail::async_mutex;
|
||||
using endpoints = boost::mqtt5::detail::endpoints<logger_type>;
|
||||
using log_invoke = boost::mqtt5::detail::log_invoke<logger_type>;
|
||||
|
||||
executor_type _stream_executor;
|
||||
detail::async_mutex _conn_mtx;
|
||||
async_mutex _conn_mtx;
|
||||
asio::steady_timer _connect_timer;
|
||||
detail::endpoints<logger_type> _endpoints;
|
||||
endpoints _endpoints;
|
||||
|
||||
stream_ptr _stream_ptr;
|
||||
stream_context_type& _stream_context;
|
||||
|
||||
detail::log_invoke<logger_type> _log;
|
||||
log_invoke _log;
|
||||
|
||||
template <typename Stream>
|
||||
friend class boost::mqtt5::detail::reconnect_op;
|
||||
@ -57,7 +61,7 @@ public:
|
||||
test_autoconnect_stream(
|
||||
const executor_type& ex,
|
||||
stream_context_type& context,
|
||||
detail::log_invoke<logger_type>& log
|
||||
log_invoke& log
|
||||
) :
|
||||
_stream_executor(ex),
|
||||
_conn_mtx(_stream_executor),
|
||||
@ -78,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
bool is_open() const noexcept {
|
||||
return detail::lowest_layer(*_stream_ptr).is_open();
|
||||
return boost::mqtt5::detail::lowest_layer(*_stream_ptr).is_open();
|
||||
}
|
||||
|
||||
void brokers(std::string hosts, uint16_t default_port) {
|
||||
@ -87,7 +91,7 @@ public:
|
||||
|
||||
static void open_lowest_layer(const stream_ptr& sptr, asio::ip::tcp protocol) {
|
||||
error_code ec;
|
||||
auto& layer = detail::lowest_layer(*sptr);
|
||||
auto& layer = boost::mqtt5::detail::lowest_layer(*sptr);
|
||||
layer.open(protocol, ec);
|
||||
layer.set_option(asio::socket_base::reuse_address(true), ec);
|
||||
layer.set_option(asio::ip::tcp::no_delay(true), ec);
|
||||
@ -95,12 +99,12 @@ public:
|
||||
|
||||
void close() {
|
||||
error_code ec;
|
||||
detail::lowest_layer(*_stream_ptr).close(ec);
|
||||
boost::mqtt5::detail::lowest_layer(*_stream_ptr).close(ec);
|
||||
}
|
||||
|
||||
stream_ptr construct_next_layer() const {
|
||||
stream_ptr sptr;
|
||||
if constexpr (detail::has_tls_context<StreamContext>)
|
||||
if constexpr (boost::mqtt5::detail::has_tls_context<StreamContext>)
|
||||
sptr = std::make_shared<stream_type>(
|
||||
_stream_executor, _stream_context.tls_context()
|
||||
);
|
||||
@ -123,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
detail::log_invoke<logger_type>& log() {
|
||||
log_invoke& log() {
|
||||
return _log;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user