CI | master | develop | last commit |
---|---|---|---|
appveyor | |||
travis |
- The library is distributed under BSD (3-Clause) license for more information read the license file.
- The library uses SemVer.
- The library requires C++ 11 or higher.
- The library's versions from the
master
branch are available in our [bintray] conan remote.
sts-signals/X.Y.Z@steptosky/stable
- In this library some dirty hacks are used to make slots calling as fast as possible.
Author of those hacks doesn't exactly know when those hacks can lead to problems, in theory never but it isn't guaranteed. For some controversial situations the tests are written.
The definitionSTS_SIGNALS_SAFE_DELEGATE
turns off those hacks. You can find more information about this definition in thests::signals::Signal
class description in source file. - This implementation isn't thread safe.
- This implementation doesn't work with return value. Author thinks it isn't necessary, you can use reference parameter in signal to make needed behavior.
- This implementation has auto-disconnect implementation for objects with slots, see
sts::signals::AutoDisconnect
class. - This implementation doesn't support std::function and lambdas.
- As the library hasn't got the major version the library's interface and logic are not stable and can be changed at any time.
class Sender {
public:
// declaration of a signal.
sts::signals::Signal<bool, int> mSignal;
};
// If you want the slots to be auto-disconnected when your Receiver object is being deleted
// you just have to inherit your Receiver from sts::signals::AutoDisconnect and nothing more.
// Auto-disconnect doesn't work for static functions.
class Receiver : public sts::signals::AutoDisconnect {
public:
static void slotStaticFunction(bool, int){}
void slotMethod(bool, int){}
};
Sender senderObj;
Receiver receiverObj;
// Connecting slots to the signal.
senderObj.mSignal.connect(&Receiver::slotStaticFunction); // static function
senderObj.mSignal.connect(&receiverObj, &Receiver::slotMethod); // class method
// invoke signal.
senderObj.mSignal(true, 5);
// Disconnecting slots from the signal
sender.mSignal.disconnect(&Receiver::slotStaticFunctiond); // static function
sender.mSignal.disconnect(&receiverObj, &Receiver::slotMethod); // class method
// or
sender.mSignal.disconnect(&receiverObj); // all class methods of given pointer
- Cmake 3.7+ - build tool.
- Conan 1.5+ - dependency tool.
- Python 2 or 3 - is needed for the Conan.
- Doxygen - if you want to generate the documentation.
- Gtest and Gmock 1.8 - testing (used through the Conan).
Run from the root folder doxygen doxyfile
the result will be in the doc-generated
folder.
The doxygen
has to be accessible through your PATH
environment variable.
- CONAN_TESTING_REPORT_DIR=(string path) - A path for storing tests results. Default value is specified in the cmake script.
- CONAN_BUILD_TESTING=(0 or 1) - Enables/disables building and running the tests.
If you setBUILD_TESTING=ON
as a parameter while runningcmake
command it will auto-setCONAN_BUILD_TESTING=1
.
- BUILD_TESTING=(ON/OFF) - Enables/disables building test projects. It is standard cmake variable.
- TESTING_REPORT_DIR=(string path) - You can specify the directory for the tests reports, it can be useful for CI.
Sometimes you will need to delete the file cmake/conan.cmake
then the newer version of this file will be downloaded from the Internet while running cmake
command.
This file is responsible for cmake and conan interaction.
These are just examples, probably you will need to adjust them for your purposes.
::==========================================================
@echo off
:: Fix problems with some symbols
REM change CHCP to UTF-8
CHCP 1252
CLS
::==========================================================
set dir="msvc"
if not exist %dir% mkdir %dir%
cd %dir%
::==========================================================
::conan user userName -r remote -p password
::==========================================================
call cmake -G "Visual Studio 15 Win64" ../ ^
-DCMAKE_INSTALL_PREFIX=../output ^
-DBUILD_TESTING=ON
:: Keep it commented if you want to generate VS project only
:: (without building), otherwise uncomment it.
::call cmake --build . --target install --config Release
::call cmake --build . --target install --config Debug
::==========================================================
cd ../
pause
::==========================================================
#===========================================================
dir_name="build-release"
#===========================================================
rm -r ${dir_name}
mkdir ${dir_name}
cd ${dir_name}
#===========================================================
#conan user userName -r remote -p password
#===========================================================
cmake -G"Unix Makefiles" ../ \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX=../output \
-DBUILD_TESTING=ON
cmake --build . --target install
cd ../
#===========================================================
#===========================================================
dir_name="build-release"
#===========================================================
rm -r ${dir_name}
mkdir ${dir_name}
cd ${dir_name}
#===========================================================
#conan user userName -r remote -p password
#===========================================================
cmake -G"Unix Makefiles" ../ \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX=../output \
-DBUILD_TESTING=ON
cmake --build . --target install
cd ../
#===========================================================
These are just examples for Windows, probably you will need to adjust them for your purposes.
::==========================================================
::conan user userName -r remote -p password
::==========================================================
call conan create . steptosky/develop ^
-s compiler="Visual Studio" ^
-s compiler.version=15 ^
-s compiler.runtime=MD ^
-s build_type=Release ^
-o sts-signals:shared=True ^
-e CONAN_TESTING_REPORT_DIR="report/conan-test" ^
-e CONAN_BUILD_TESTING=1 ^
--build=sts-signals ^
--build=outdated
call conan create . steptosky/develop ^
-s compiler="Visual Studio" ^
-s compiler.version=15 ^
-s compiler.runtime=MDd ^
-s build_type=Debug ^
-o sts-signals:shared=True ^
-e CONAN_TESTING_REPORT_DIR="report/conan-test" ^
-e CONAN_BUILD_TESTING=1 ^
--build=sts-signals ^
--build=outdated
pause
:: remove build dir
rd /s/q "test_package/build"
::==========================================================
::conan user userName -r remote -p password
::==========================================================
:: https://github.com/conan-io/conan-package-tools
set CONAN_USERNAME=steptosky
set CONAN_CHANNEL=testing
set CONAN_BUILD_TESTING=1
set CONAN_TESTING_REPORT_DIR=report
set CONAN_BUILD_POLICY=missing
set CONAN_STABLE_BRANCH_PATTERN=master
set CONAN_UPLOAD_ONLY_WHEN_STABLE=1
set CONAN_VISUAL_VERSIONS=15
set CTEST_OUTPUT_ON_FAILURE=1
call python build.py
:: uncomment it if you want to
:: remove all packages from all versions
:: from testing channel
:: conan remove sts-signals/*@steptosky/testing -f
pause
:: remove build dir
rd /s/q "test_package/build"
After building the package will be available in the conan local cache, so you can use it in your other projects on local PC.
- release-checklist see this file when you are making the release.
- changelog this file has to be filled during the release process and contains information about changes.
- conan-package-tools.
- lasote docker hub.
Copyright (c) 2018, StepToSky team. All rights reserved.
www.steptosky.com