Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ But RPP is header-only library, so, without enabling any extra options is just c
- `RPP_BUILD_TESTS` - (ON/OFF) build unit tests (default OFF)
- `RPP_BUILD_EXAMPLES` - (ON/OFF) build examples of usage of RPP (default OFF)
- `RPP_BUILD_SFML_CODE` - (ON/OFF) build RPP code related to SFML or not (default OFF) - requires SFML to be installed
- `RPP_BUILD_QT_CODE` - (ON/OFF) build QT related code (examples/tests)(rppqt module doesn't requires this one) (default OFF) - requires QT5/6 to be installed
- `RPP_BUILD_GRPC_CODE` - (ON/OFF) build GRPC related code (examples/tests)(rppgrpc module doesn't requires this one) (default OFF) - requires grpc++/protobuf to be installed
- `RPP_BUILD_QT_CODE` - (ON/OFF) build QT related code (examples/tests)(rppqt module doesn't require this one) (default OFF) - requires QT5/6 to be installed
- `RPP_BUILD_GRPC_CODE` - (ON/OFF) build GRPC related code (examples/tests)(rppgrpc module doesn't require this one) (default OFF) - requires grpc++/protobuf to be installed
- `RPP_BUILD_ASIO_CODE` - (ON/OFF) build RPPASIO related code (examples/tests)(rppasio module doesn't require this one) (default OFF) - requires asio to be installed

By default, it provides rpp and rppqt INTERFACE modules.

Expand Down
29 changes: 18 additions & 11 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@
"RPP_BUILD_GRPC_CODE" : "ON"
}
},
{
"name" : "build-asio",
"hidden": true,
"cacheVariables": {
"RPP_BUILD_ASIO_CODE" : "ON"
}
},
{
"name" : "use-conan",
"hidden": true,
Expand All @@ -168,7 +175,7 @@
},
{
"name": "ci-coverage-clang",
"inherits": ["ci-build", "build-tests", "build-qt", "build-grpc", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-qt", "build-grpc", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"RPP_ENABLE_COVERAGE": "ON",
"CMAKE_CXX_FLAGS": "-O0 -g -fprofile-instr-generate -fcoverage-mapping --coverage",
Expand All @@ -177,58 +184,58 @@
},
{
"name": "ci-sanitize-tsan",
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-fsanitize=thread -g -O1"
}
},
{
"name": "ci-sanitize-asan",
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
}
},
{
"name": "ci-sanitize-lsan",
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-fsanitize=leak -fno-omit-frame-pointer -g -O1"
}
},
{
"name": "ci-sanitize-msan",
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O2"
}
},
{
"name": "ci-sanitize-ubsan",
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "ci-unix", "ci-clang"],
"inherits": ["ci-build", "build-tests", "build-benchmarks", "build-qt", "build-grpc", "build-asio", "ci-unix", "ci-clang"],
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-fsanitize=undefined"
}
},
{
"name": "ci-macos-tests",
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-sfml", "ci-unix"]
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-asio", "build-sfml", "ci-unix"]
},
{
"name": "ci-ubuntu-clang-tests",
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-sfml", "ci-unix", "ci-clang", "cppcheck", "clang-tidy"]
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-asio", "build-sfml", "ci-unix", "ci-clang", "cppcheck", "clang-tidy"]
},
{
"name": "ci-ubuntu-gcc-tests",
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-sfml", "ci-unix", "ci-gcc", "cppcheck", "clang-tidy"]
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-asio", "build-sfml", "ci-unix", "ci-gcc", "cppcheck", "clang-tidy"]
},
{
"name": "ci-windows-tests",
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-sfml", "ci-win64"]
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-asio", "build-sfml", "ci-win64"]
},
{
"name": "ci-ubuntu-clang-tests-no-checks",
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-sfml", "ci-unix", "ci-clang" ]
"inherits": ["ci-build", "build-tests", "build-examples", "build-qt", "build-grpc", "build-asio", "build-sfml", "ci-unix", "ci-clang" ]
},


Expand Down
10 changes: 10 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,13 @@ endif()
if (RPP_BUILD_BENCHMARKS)
rpp_fetch_library(nanobench https://github.com/martinus/nanobench.git master)
endif()

# ==================== ASIO =====================
if (RPP_BUILD_ASIO_CODE)
find_package(asio REQUIRED)

macro(rpp_add_asio_support_to_executable TARGET)
target_link_libraries(${TARGET} PRIVATE asio::asio)
target_compile_definitions(${TARGET} PRIVATE "ASIO_NO_TYPEID")
endmacro()
endif()
6 changes: 6 additions & 0 deletions cmake/install-rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ install(
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rppgrpc"
)

install(
TARGETS rppasio
EXPORT RPPTargets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rppasio"
)

write_basic_package_version_file(
"${package}ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
Expand Down
4 changes: 4 additions & 0 deletions cmake/variables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ endfunction()
option(RPP_BUILD_SFML_CODE "Enable SFML support in examples/code." OFF)
option(RPP_BUILD_QT_CODE "Enable QT support in examples/code." OFF)
option(RPP_BUILD_GRPC_CODE "Enable grpc++ support in examples/code." OFF)
option(RPP_BUILD_ASIO_CODE "Enable ASIO support in examples/code." OFF)

if (RPP_DEVELOPER_MODE)
option(RPP_BUILD_TESTS "Build unit tests tree." OFF)
Expand All @@ -104,6 +105,9 @@ if (RPP_DEVELOPER_MODE)
if (RPP_BUILD_GRPC_CODE)
set(CONAN_ARGS "${CONAN_ARGS};-o rpp/*:with_grpc=True")
endif()
if (RPP_BUILD_ASIO_CODE)
set(CONAN_ARGS "${CONAN_ARGS};-o rpp/*:with_asio=True")
endif()
endif()

if(RPP_ENABLE_COVERAGE)
Expand Down
9 changes: 7 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ class RppConan(ConanFile):
"with_sfml" : [False, True],
"with_tests" : [False, True],
"with_cmake" : [False, True],
"with_benchmarks" : [False, True]
"with_benchmarks" : [False, True],
"with_asio" : [False, True]
}
default_options = {
"with_grpc" : False,
"with_sfml" : False,
"with_tests": False,
"with_cmake": False,
"with_benchmarks" : False
"with_benchmarks" : False,
"with_asio" : False
}

def requirements(self):
Expand All @@ -37,5 +39,8 @@ def requirements(self):
self.requires("protobuf/3.21.12")
self.requires("libmount/2.39", override=True)

if self.options.with_asio:
self.requires("asio/1.30.2")

if self.options.with_cmake:
self.tool_requires("cmake/3.29.3")
1 change: 1 addition & 0 deletions src/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(rppqt)
add_subdirectory(rppgrpc)
add_subdirectory(rppasio)
11 changes: 11 additions & 0 deletions src/extensions/rppasio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ReactivePlusPlus library
#
# Copyright Aleksey Loginov 2022 - present.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
#
# Project home: https://github.com/victimsnino/ReactivePlusPlus
#

rpp_add_library(rppasio)
23 changes: 23 additions & 0 deletions src/extensions/rppasio/rppasio/fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ReactivePlusPlus library
//
// Copyright Aleksey Loginov 2022 - present.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/victimsnino/ReactivePlusPlus
//

#pragma once

/**
* @defgroup rppasio RPPASIO
* @brief RppAsio is extension of RPP which enables support of boost-asio library.
*/


/**
* @defgroup asio_schedulers Asio Schedulers
* @ingroup rppasio
*/
#include <rppasio/schedulers/fwd.hpp>
14 changes: 14 additions & 0 deletions src/extensions/rppasio/rppasio/rppasio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// ReactivePlusPlus library
//
// Copyright Aleksey Loginov 2022 - present.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/victimsnino/ReactivePlusPlus
//

#pragma once

#include <rppasio/fwd.hpp>
#include <rppasio/schedulers.hpp>
20 changes: 20 additions & 0 deletions src/extensions/rppasio/rppasio/schedulers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ReactivePlusPlus library
//
// Copyright Aleksey Loginov 2022 - present.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/victimsnino/ReactivePlusPlus
//

#pragma once

/**
* @defgroup asio_schedulers Asio Schedulers
* @brief Scheduler is the way to introduce multi-threading in your application via RPP
* @see https://reactivex.io/documentation/scheduler.html
* @ingroup rppasio
*/

#include <rppasio/schedulers/thread_pool.hpp>
16 changes: 16 additions & 0 deletions src/extensions/rppasio/rppasio/schedulers/fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// ReactivePlusPlus library
//
// Copyright Aleksey Loginov 2022 - present.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/victimsnino/ReactivePlusPlus
//

#pragma once

namespace rppasio::schedulers
{
class strand;
} // namespace rppasio::schedulers
Loading