Menu

Building SObjectizer

Yauheni Akhotnikau Boris Sivko korish

Note. Each SObjectizer's source code archive includes README file with detailed instructions how to build the specific SObjectizer version.

Building From Source Code

Obtaining Source Code

SObjectizer can be downloaded from SourceForge as an archive or exported/checkedout from Subversion repository, or checkedout from mirror on GitHub.

There are two ways for building SObjectizer. The first one by using Mxx_ru tool. The second one by using CMake.

Building via Mxx_ru

NOTE. This is a standard way for building SObjectizer. This way is used in SObjectizer development process.

To build SObjectizer it is necessary to use Ruby language and Mxx_ru tool. Install Ruby and then install Mxx_ru via RubyGems command:

gem install Mxx_ru

If you already have Mxx_ru installed please update to at least version 1.6.4:

gem update Mxx_ru

SObjectizer can be obtained from Subversion repository on SourceForge:

svn export http://svn.code.sf.net/p/sobjectizer/repo/tags/so_5/5.5.15.1 so-5.5.15.1

To build SObjectizer:

cd so-5.5.15.1/dev
ruby build.rb

Or to build SObjectizer with all tests and samples:

cd so-5.5.15.1/dev
ruby build_all.rb

Please note that under Linux/FreeBSD it may be necessary to define LD_LIBRARY_PATH environment variable. And the actual build command sequence under Linux can be as follows:

cd so-5.5.15.1/dev
export LD_LIBRARY_PATH=.
ruby build_all.rb

To build html-format documentation for SObjectizer the Doxygen tool is necessary. If it is installed then:

cd so-5.5.15.1/doxygen
doxygen

Generated html-files will be located in so-5.5.15.1/dev/doc/html.

NOTE. If you do not specify MXX_RU_CPP_TOOLSET by youself then Mxx_ru will try to detect your C++ toolset automatically. If you want to use C++ compiler which is not default in your system please define MXX_RU_CPP_TOOLSET environment variable manually. It can look like:

export MXX_RU_CPP_TOOLSET="clang_linux compiler_name=clang++-3.5 linker_name=clang++-3.5"

More information about tuning Mxx_ru for your needs you can find in the corresponding documentation.

Building via CMake

NOTE. This way of building is not used by SObjectizer developers. Nevertheless, CMake-related files are in an actual state, they are maintained by SObjectizer Team and can be used for building SObjectizer, its samples and tests.

NOTE. It is better to have a rather new version of CMake. The oldest CMake version which has been tested is 3.2. The version 3.8 or newer is prefered.

To build SObjectizer via CMake it is necessary to have CMake and some knowledge of how to use it. The following action is just a demonstration. For more detailed info about cmake build system for SObjectizer see dev/cmake/CmakeQuickHowto.txt

To get and build SObjectizer under Linux/FreeBSD in command line run:

svn export http://svn.code.sf.net/p/sobjectizer/repo/tags/so_5/5.5.20 so-5.5.20
cd so-5.5.20
mkdir cmake_build
cd cmake_build
cmake -DCMAKE_INSTALL_PREFIX=target -DCMAKE_BUILD_TYPE=Release ../dev
cmake --build . --config Release
cmake --build . --config Release --target install

Those commands will create all necessary Makefile, then build SObjectizer. If it necessary to build examples and tests too, use

cmake -DBUILD_ALL=ON -DCMAKE_INSTALL_PREFIX=target ../dev

When 'make install' finished './target' will contain two subfolders './bin' with samples and './lib' with shared libso.5.x.x.so

CMake build system currently supports this options:

SOBJECTIZER_BUILD_STATIC   Enable building SObjectizer as a static library [default: ON]
SOBJECTIZER_BUILD_SHARED   Enable building SObjectizer as a shared library [default: ON]

BUILD_ALL      Enable building examples and tests [default: OFF]
BUILD_EXAMPLES Enable building examples [default: OFF]
BUILD_TESTS    Enable building tests    [default: OFF]

Please note that if BUILD_ALL or BUILD_EXAMPLES or BUILD_TESTS is turned ON then both SOBJECTIZER_BUILD_STATIC and SOBJECTIZER_BUILD_SHARED must be turned ON. It means that if SOBJECTIZER_BUILD_STATIC or SOBJECTIZER_BUILD_SHARED is turned OFF then BUILD_ALL/BUILD_EXAMPLES/BUILD_TESTS all must be turned OFF.

To build SObjectizer under Windows by MS Visual Studio 2013 from command line:

cd so-5.5.20
mkdir cmake_build
cd cmake_build
cmake -DCMAKE_INSTALL_PREFIX=target -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 14 2015" ../dev
cmake --build . --config Release
cmake --build . --config Release --target install

If it necessary to build examples too, use BUILD_ALL in cmake invocation:

cmake -DCMAKE_INSTALL_PREFIX=target -DCMAKE_BUILD_TYPE=Release -DBUILD_ALL=ON -G "Visual Studio 14 2015" ../dev

Since v.5.5.20 SObjectizer provides sobjectizer-config.cmake files. These files are automatically installed into <target>/lib/cmake/sobjectizer subfolder. It allows to use SObjectizer via CMake's find_package command.</target>

See also [5.5.20 Enhanced support for CMake] for more information about using SObjectizer in your projects via CMake.

Installing Binary Version By Hand

SObjectizer is distributed as a precompiled binary version for Windows and Visual C++. Simply download the appropriate archive from Files section and unpack it somewhere. Then, add the path to dev/ and dev/lib subdirs for your INCLUDE and LIB paths respectively (in Visual Studio project properties or environment variables).

Using C++ Dependency Managers

Using via vcpkg

To use SObjectizer via vcpkg it is necessary to do the following steps.

Install sobjectizer package:

vcpkg install sobjectizer

Add the following lines into your CMakeLists.txt file:

find_package(sobjectizer CONFIG REQUIRED)
target_link_libraries(your_target sobjectizer::SharedLib) # or sobjectizer::StaticLib

Using via Conan

Installing SObjectizer And Adding It To conanfile.txt

To use SObjectizer via Conan it is necessary to do the following steps:

Add the corresponding remote to your conan:

conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public

Add SObjectizer to conanfile.txt of your project:

[requires]
sobjectizer/5.5.23@stiffstream/testing

It also may be necessary to specify shared option for SObjectizer. For example, for build SObjectizer as a static library:

[options]
sobjectizer:shared=False

Install dependencies for your project:

conan install SOME_PATH --build=missing

Adding SObjectizer To Your CMakeLists.txt

Please note that SObjectizer should be added to your CMakeLists.txt via find_package command:

...
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(sobjectizer CONFIG REQUIRED)
...
target_link_libraries(your_target sobjectizer::SharedLib) # Or sobjectizer::StaticLib

Related

Wiki: 5.5.20 Enhanced support for CMake
Wiki: Home