-
Notifications
You must be signed in to change notification settings - Fork 131
Build instructions
The source code of C++React is organized as follows:
cpp.react/
(Core library)
include/ - Header files
src/ - Source files
(Unit tests)
tests/
src/
(Examples)
examples/
src/
(Benchmarks)
benchmarks/
src/
For use in your project, only the core library is relevant.
-
C++React uses Intel's Threading Building Blocks (TBB). It is the only mandatory dependency.
-
Certain core library features also require the
boost::coroutine
library that's part of Boost 1.55.0 As long as these features are not used andReactor.h
is not included,boost::coroutine
is not required for the build. -
Compiling and running the unit tests requires the Google Test Framework.
A pre-made Visual Studio solution can be found in cpp.react/project/msvc/
.
Supported versions are Visual Studio 2013.2 or newer.
The setup instructions may depend on the current version, but in general they are:
- Download the binary package for Windows and extract it to location of your choice (referred to as
%TBB_ROOT%
). - Add
%TBB_ROOT%/include
to the list of include directories. - Add
%TBB_ROOT%/lib/ia32/vc12
to the list of library directories (assuming your target platform is Win32). - Add
%TBB_ROOT%/bin/ia32/vc12
to your binary search path (assuming your target platform is Win32).
For more details, refer to the TBB manual.
The core library is built by the project CppReact
.
Compiling it will produce the static library CppReact.lib
in cpp.react/build/<Configuration>/
.
The examples are organized in multiple projects founds in the respective solution folder. Most of the examples have no further dependencies, so building them is straightforward. They can be used to confirm that the basic setup was successful.
An exception is the project Example_BasicReactors
, which requires boost::coroutine
.
All tests are built by a single project CppReactTest
.
To produce an executable, it should be linked with gtestd.lib
and gtest_main-mdd.lib
.
Depending on your operating system, there may exist pre-built packages for the dependencies. For example, in Ubuntu 14.04 the respective packages are named:
(TBB)
libtbb-dev
(gtest)
libgtest-dev
(Boost coroutine)
libboost-system1.55-dev
libboost-context1.55-dev
libboost-coroutine1.55-dev
CMake supports out-of-soure-builds, so first create a build/
folder in the cpp.react/
root folder:
mkdir build/
cd build
Next, run the build:
cmake ..
make
The resulting binaries are written to ./lib
and ./bin
.
Any targets requiring boost::coroutine
will be skipped if it was not found.
CMake can be configured with the following parameters:
build_examples (default: ON)
build_benchmarks (default: OFF)
build_tests (default: OFF)
Furthermore, the environment variable GTEST_DIR
is used to specificy the location of the gtest source.
By default, only the core library and the examples are built.
To build everything:
GTEST_DIR=/usr/src/gtest cmake -Dbuild_tests=ON -Dbuild_benchmarks=ON -Dbuild_examples=ON ..
make