Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
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
45 changes: 35 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
CATCH2_VERSION: v3.1.0
Catch2_DIR: ~/Catch2_BIN


jobs:
download_deps:
strategy:
Expand Down Expand Up @@ -60,6 +61,9 @@ jobs:
- name: Install LCov
run: sudo apt-get update -q && sudo apt-get install lcov -q -y

- name: Install Qt
uses: jurplel/install-qt-action@v3

- name: Restore Catch2
uses: actions/cache@v3
id: cache-catch2
Expand Down Expand Up @@ -92,6 +96,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3

- name: Restore Catch2
uses: actions/cache@v3
id: cache-catch2
Expand Down Expand Up @@ -125,10 +132,16 @@ jobs:
with:
fetch-depth: 0

- name: Install Qt
if: matrix.type == 'tests'
uses: jurplel/install-qt-action@v3

- name: Install deps
if: matrix.config.os != 'windows-latest'
run: sudo apt-get update -q && sudo apt-get install clang-tidy cppcheck libsfml-dev -y -q

run: |
sudo apt-get update -q && sudo apt-get install clang-tidy cppcheck libsfml-dev -y -q
pip install pyyaml

- name: Restore Catch2
uses: actions/cache@v3
id: cache-catch2
Expand Down Expand Up @@ -182,6 +195,9 @@ jobs:
with:
path: ${{env.Catch2_DIR}}
key: catch2-${{env.CATCH2_VERSION}}-ubuntu-latest

- name: Install Qt
uses: jurplel/install-qt-action@v3

- name: Cache SonarCloud packages
uses: actions/cache@v3
Expand All @@ -205,7 +221,7 @@ jobs:
CXX: g++-10
run: |
mkdir build
cmake -S . -B build -DRPP_BUILD_TESTS=1
cmake -S . -B build -DRPP_BUILD_TESTS=1 -DRPP_BUILD_QT_CODE=1
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release --parallel 2

- name: Upload results
Expand All @@ -216,13 +232,8 @@ jobs:

docs:
name: Build Doxygen Docs

needs: [sanitize, tests]

runs-on: ubuntu-latest

if: github.event_name == 'push' && github.repository_owner == 'victimsnino'

steps:
- uses: actions/checkout@v3

Expand All @@ -232,13 +243,27 @@ jobs:
- name: Install deps
run: |
pip3 install rxmarbles
sudo apt-get install doxygen
export CC=clang
export CXX=clang++
sudo apt install llvm-11 clang-11 libclang-11-dev flex bison -q -y
git clone https://github.com/doxygen/doxygen.git --depth 1
cd doxygen && mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install

- name: Doxygen
run: doxygen ./Doxyfile

- name: Update docs
run: |
grep -rl "rpp::details::member_overload" gen_docs | xargs sed -i 's/rpp::details::member_overload< Type, SpecificObservable, [a-zA-Z_]*_tag >/observable/g'
grep -rl "rpp::details::member_overload" gen_docs | xargs sed -i 's/rpp::details::member_overload<\/a>&lt; Type, SpecificObservable, [a-zA-Z_]*_tag &gt;/observable<\/a>/g'
grep -rl "rpp::details::member_overload" gen_docs | xargs sed -i 's/rpp::details::member_overload< Type, SpecificObservable, [a-zA-Z_]*_tag >:://g'

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && github.repository_owner == 'victimsnino'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gen_docs
Expand All @@ -264,6 +289,6 @@ jobs:
cmake -B build
sudo cmake --build build --target install --parallel 2 --config Release

cmake -B sample_build -S src/examples/package
cmake -B sample_build -S src/examples/rpp/package
cmake --build sample_build --parallel 2 --config Release

2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Cmake
run: cmake -S . -B build -DRPP_BUILD_TESTS=1
run: cmake -S . -B build -DRPP_BUILD_TESTS=1 -DRPP_BUILD_QT_CODE=1

- name: Set up JDK 11
uses: actions/setup-java@v3
Expand Down
6 changes: 4 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@
"name" : "ci-build-tests",
"hidden": true,
"cacheVariables": {
"RPP_BUILD_TESTS" : "ON"
"RPP_BUILD_TESTS" : "ON",
"RPP_BUILD_QT_CODE" : "ON"
}
},
{
"name" : "ci-build-examples",
"hidden": true,
"cacheVariables": {
"RPP_BUILD_EXAMPLES" : "ON"
"RPP_BUILD_EXAMPLES" : "ON",
"RPP_BUILD_QT_CODE" : "ON"
}
},
{
Expand Down
17 changes: 15 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = src/rpp src/examples/doxygen docs
INPUT = src/rpp src/rppqt src/examples/rpp/doxygen src/examples/rppqt/doxygen docs

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -996,7 +996,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH = src/examples/doxygen
EXAMPLE_PATH = src/examples/rpp/doxygen src/examples/rppqt/doxygen

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down Expand Up @@ -1308,6 +1308,19 @@ HTML_EXTRA_STYLESHEET =

HTML_EXTRA_FILES =

# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
# should be rendered with a dark or light theme.
# Possible values are: LIGHT always generate light mode output, DARK always
# generate dark mode output, AUTO_LIGHT automatically set the mode according to
# the user preference, use light mode if no preference is set (the default),
# AUTO_DARK automatically set the mode according to the user preference, use
# dark mode if no preference is set and TOGGLE allow to user to switch between
# light and dark mode via a button.
# The default value is: AUTO_LIGHT.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_COLORSTYLE = LIGHT

# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a color-wheel, see
Expand Down
28 changes: 25 additions & 3 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
find_package(Threads REQUIRED)

# ===================== SFML =======================
if (RPP_BUILD_SFML_CODE)
if (RPP_BUILD_SFML_CODE AND RPP_BUILD_EXAMPLES)
find_package(SFML COMPONENTS graphics system window REQUIRED)
endif()

# ==================== QT ==========================
if (RPP_BUILD_QT_CODE AND (RPP_BUILD_TESTS OR RPP_BUILD_EXAMPLES))
find_package(Qt6 COMPONENTS Widgets)
if (Qt6_FOUND)
SET(RPP_QT_TARGET Qt6)
else()
find_package(Qt5 REQUIRED COMPONENTS Widgets)
SET(RPP_QT_TARGET Qt5)
endif()

message("-- RPP: Found QT version: ${RPP_QT_TARGET}")
macro(rpp_add_qt_support_to_executable TARGET)
target_link_libraries(${TARGET} PRIVATE ${RPP_QT_TARGET}::Widgets)
set_target_properties(${TARGET} PROPERTIES AUTOMOC TRUE)
if (WIN32)
add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${RPP_QT_TARGET}::Core> $<TARGET_FILE_DIR:${TARGET}>)
add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${RPP_QT_TARGET}::Widgets> $<TARGET_FILE_DIR:${TARGET}>)
add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${RPP_QT_TARGET}::Gui> $<TARGET_FILE_DIR:${TARGET}>)
endif()
endmacro()
endif()

# ==================== RXCPP =======================
if (RPP_BUILD_RXCPP)
if (RPP_BUILD_RXCPP AND RPP_BUILD_BENCHMARKS)
set(RXCPP_DISABLE_TESTS_AND_EXAMPLES 1)
Include(FetchContent)

Expand Down Expand Up @@ -36,4 +58,4 @@ if (RPP_BUILD_TESTS OR RPP_BUILD_BENCHMARKS)
)
FetchContent_MakeAvailable(Catch2)
endif()
endif()
endif()
1 change: 1 addition & 0 deletions cmake/variables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ endif()

# ------------ Options to tweak ---------------------
option(RPP_BUILD_SFML_CODE "Enable SFML support in examples/code." OFF)
option(RPP_BUILD_QT_CODE "Enable QT support and add rppqt library." OFF)

if (RPP_DEVELOPER_MODE)
option(RPP_BUILD_TESTS "Build unit tests tree." OFF)
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.organization=victimsnino
sonar.projectName=ReactivePlusPlus

# SQ standard properties
sonar.sources=src/rpp,src/tests/
sonar.sources=src/rpp,src/rppqt,src/tests/
sonar.coverage.exclusions=src/tests/**/*
sonar.cpd.exclusions=src/tests/**/*
sonar.issue.ignore.allfile=a1
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

add_subdirectory(rpp)

if(RPP_BUILD_QT_CODE)
add_subdirectory(rppqt)
endif()

if (RPP_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()

if(RPP_BUILD_TESTS)
add_subdirectory(tests)
endif()
Expand Down
9 changes: 3 additions & 6 deletions src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
add_subdirectory(basic)
add_subdirectory(doxygen)
add_subdirectory(petri)

if (RPP_BUILD_SFML_CODE)
add_subdirectory(sfml)
add_subdirectory(rpp)
if(RPP_BUILD_QT_CODE)
add_subdirectory(rppqt)
endif()
7 changes: 7 additions & 0 deletions src/examples/rpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
add_subdirectory(basic)
add_subdirectory(doxygen)
add_subdirectory(petri)

if (RPP_BUILD_SFML_CODE)
add_subdirectory(sfml)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ add_executable(basic_sample
)

target_link_libraries(basic_sample PRIVATE RPP::rpp)
set_target_properties(basic_sample PROPERTIES FOLDER Examples)
set_target_properties(basic_sample PROPERTIES FOLDER Examples/rpp)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ foreach(SOURCE ${FILES})
set(TARGET ${BASE_NAME}_doxygen_sample)
add_executable(${TARGET} ${SOURCE})
target_link_libraries(${TARGET} PRIVATE rpp)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/Doxygen)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/rpp/Doxygen)
endforeach()

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ add_executable(petri_executor
)

target_link_libraries(petri_executor PRIVATE rpp)
set_target_properties(petri_executor PROPERTIES FOLDER Examples)
set_target_properties(petri_executor PROPERTIES FOLDER Examples/rpp)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_executable(${TARGET}
)

target_link_libraries(${TARGET} PRIVATE rpp sfml-graphics)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/SFML)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/rpp/SFML)

if (WIN32)
add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:sfml-graphics> $<TARGET_FILE_DIR:${TARGET}>)
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/examples/rppqt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(interactive_window)
add_subdirectory(doxygen)
11 changes: 11 additions & 0 deletions src/examples/rppqt/doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
file(GLOB_RECURSE FILES "*.cpp")

foreach(SOURCE ${FILES})
get_filename_component(BASE_NAME ${SOURCE} NAME_WE)
set(TARGET ${BASE_NAME}_doxygen_sample)
add_executable(${TARGET} ${SOURCE})
target_link_libraries(${TARGET} PRIVATE rpp rppqt)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/rppqt/Doxygen)
rpp_add_qt_support_to_executable(${TARGET})
endforeach()

33 changes: 33 additions & 0 deletions src/examples/rppqt/doxygen/from_signal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <rpp/rpp.hpp>
#include <rppqt/rppqt.hpp>

#include <iostream>
#include <QApplication>
#include <QTextEdit>

/**
* \example from_signal.cpp
**/

int main(int argc, char* argv[])
Comment thread
AlexInLog marked this conversation as resolved.
{
QApplication app{argc, argv};

//! [from_signal]
QTextEdit* text_edit = new QTextEdit();
rppqt::source::from_signal(*text_edit, &QTextEdit::textChanged).map([&](const auto&)
{
return text_edit->toPlainText();
}).subscribe([](const QString& text) { std::cout << "text changed: " << text.toStdString() << std::endl;},
[](){ std::cout << "text_edit destroyed!" << std::endl; });
text_edit->setText("123");
text_edit->setText("temp");
delete text_edit;
// Output:
// text changed: 123
// text changed: temp
// text_edit destroyed!
//! [from_signal]

return 0;
}
9 changes: 9 additions & 0 deletions src/examples/rppqt/interactive_window/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SET(TARGET interactive_window)
add_executable(${TARGET}
${TARGET}.cpp
)

target_link_libraries(${TARGET} PRIVATE rppqt ${RPP_QT_TARGET}::Widgets)
set_target_properties(${TARGET} PROPERTIES FOLDER Examples/rppqt)

rpp_add_qt_support_to_executable(${TARGET})
Loading