diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml
new file mode 100644
index 0000000..7dfe648
--- /dev/null
+++ b/.github/workflows/cmake-multi-platform.yml
@@ -0,0 +1,74 @@
+name: CMake on multiple platforms
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "**" ]
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
+ fail-fast: false
+
+ matrix:
+ os: [ubuntu-24.04, windows-latest, windows-2019]
+ build_type: [Release]
+ c_compiler: [gcc, clang, cl]
+ include:
+ - os: windows-latest
+ c_compiler: cl
+ cpp_compiler: cl
+ - os: windows-2019
+ c_compiler: cl
+ cpp_compiler: cl
+ - os: ubuntu-24.04
+ c_compiler: gcc
+ cpp_compiler: g++
+ - os: ubuntu-24.04
+ c_compiler: clang
+ cpp_compiler: clang++
+ exclude:
+ - os: windows-latest
+ c_compiler: gcc
+ - os: windows-latest
+ c_compiler: clang
+ - os: windows-2019
+ c_compiler: gcc
+ - os: windows-2019
+ c_compiler: clang
+ - os: ubuntu-24.04
+ c_compiler: cl
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set reusable strings
+ # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
+ id: strings
+ shell: bash
+ run: |
+ echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
+
+ - name: Configure CMake
+ # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
+ # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
+ run: >
+ cmake -B ${{ steps.strings.outputs.build-output-dir }}
+ -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
+ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
+ -S ${{ github.workspace }}
+
+ - name: Build
+ # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
+ run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
+
+ - name: Test
+ working-directory: ${{ steps.strings.outputs.build-output-dir }}
+ # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
+ run: ctest --build-config ${{ matrix.build_type }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fcccb13..fa14c5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,8 @@ project(tulz)
set(CMAKE_CXX_STANDARD 20)
+option(TULZ_ENABLE_TESTS "Turn it off in order to disable tests" ON)
+
set(TULZ_OBSERVER_SOURCES
include/tulz/observer/Observer.h
include/tulz/observer/Subject.h
@@ -96,4 +98,9 @@ target_include_directories(tulz PUBLIC include)
if (ANDROID)
target_include_directories(tulz PUBLIC android/include)
+endif()
+
+if (TULZ_ENABLE_TESTS)
+ enable_testing()
+ add_subdirectory(tests)
endif()
\ No newline at end of file
diff --git a/README.md b/README.md
index 250ba9f..2b7f52e 100644
--- a/README.md
+++ b/README.md
@@ -3,15 +3,6 @@
Tulz is a light-weight cross-platform C++20 tools library for C++ development.
It contains reusable classes that I use in my projects.
-## Compilers support
-
-Tested under:
-
-| Linux | Windows | Android |
-|--------------|----------------------|------------------|
-| GCC 13.3.1 | MSVC 19.37.32824 x64 | NDK 22.0.7026061 |
-| Clang 17.0.6 | Clang 16.0.0 | |
-
## Installation
1. Put sources in your libs folder
@@ -30,14 +21,4 @@ Tested under:
| Flag | Description | Mandatory | Default | Platform |
|----------------------------------------|------------------------------------------|-----------|---------|----------|
-| `TULZ_DEMANGLER_DISABLE_THREAD_SAFETY` | Controls `tulz::demangler` thread safety | No | OFF | Windows |
-
-## Examples
-
-You can find example in [examples/example.cpp](examples/example.cpp)
-
-Note that you must clone this repository to `tulz` directory to be able to run example, not `tulz-master` etc
-
-## Donate
-
-Payeer: P36281059
+| `TULZ_DEMANGLER_DISABLE_THREAD_SAFETY` | Controls `tulz::demangler` thread safety | No | OFF | Windows |
\ No newline at end of file
diff --git a/include/tulz/observer/EternalObserverFactory.h b/include/tulz/observer/EternalObserverFactory.h
index 65c519e..321e29b 100644
--- a/include/tulz/observer/EternalObserverFactory.h
+++ b/include/tulz/observer/EternalObserverFactory.h
@@ -6,7 +6,7 @@
namespace tulz {
namespace detail {
-using EternalObserverFactory_t = decltype([](EternalObserver::Func f = {}) {
+using EternalObserverFactory_t = decltype([](typename EternalObserver::Func f = {}) {
return std::make_unique>(std::move(f));
});
}
diff --git a/src/observer/routing/SubjectRouter.cpp b/src/observer/routing/SubjectRouter.cpp
index 4f3b831..c7f3eed 100644
--- a/src/observer/routing/SubjectRouter.cpp
+++ b/src/observer/routing/SubjectRouter.cpp
@@ -1,6 +1,5 @@
#include
-#include
#include
#include
@@ -43,8 +42,7 @@ void SubjectRouter::Node::shrink(RoutingLevelView levelView) {
}
// erase empty children
- // C++20: std::erase_if
- std::experimental::erase_if(m_children, [](auto &p) {
+ std::erase_if(m_children, [](auto &p) {
return p.second.isEmpty();
});
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ea6a1b1..32c69d9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,23 +1,11 @@
cmake_minimum_required(VERSION 3.14)
project(tulz-tests)
-enable_testing()
-
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
-if (UNIX)
- set(DEPS_DIR "deps")
-elseif (WIN32)
- set(DEPS_DIR "deps-win")
-else()
- message(FATAL_ERROR "Unsupported OS")
-endif()
-
-get_filename_component(FETCHCONTENT_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${DEPS_DIR}" REALPATH)
-
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0)
@@ -27,8 +15,6 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
-add_subdirectory(../ tulz)
-
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
function(add_gtest name src)