Skip to content
schwoere edited this page Feb 11, 2014 · 9 revisions

buildenvironment

Clone this repository if you want to build Ubitrack from the source code.

All other repositories are added as submodules to this repository

How to build Ubitrack

###1. Required tools In order to build ubitrack the following tools have to be installed:

  • Git

  • C++ Compiler like gcc or MSVC

  • Python (at least Version 2.7, e.g. PythonXY )

  • Scons

  • cmake (only required for building OpenCV for Android)

You can compile Ubitrack for Windows, Linux and Android on the appropriate system. However, the cross-compilation for Android is only possible on Linux. If there are any differences to the compilation for Linux, they are explained in the appropriate section.

###1.1 How to install build-tools

Ubitrack-Compilation for Windows:

Download PythonXY, Scons and Git from the official website, install them and make sure they are working and added to your system-path by opening a console and typing:

scons

Windows should respond in the following way:

scons: *** No SConstruct file found.
File "C:\Program Files (x86)\Python 2.7\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Script\Main.py", line 905, in _main

Doing the similar with git

git --version

sould be answered with something like:

git version 1.8.5.2.msysgit.0

Ubitrack-Compilation for Linux/Android on Linux

Ubuntu is shipped with gcc and python pre-installed, to install Git and Scons, open up a terminal and type:

sudo apt-get install git scons

Ubitrack-Compilation for Android on Linux

Android-NDK-Toolchain:

In addition to scons, for the compilation of Ubitrack for Android we need to compile an Android standalone-toolchain. Therefore, you have to download the Android-NDK. This HowTo will use a certain repository-files for the Boost-for-Android compilation, which needs the Android-NDK-Version 8e. If you are able to port Boost to Android on your own, feel free to download the newest Android-NDK, otherwise please download Android-NDK-Version-r8e-64-bit or Android-NDK-Version-r8e-32-bit according to your Linux architecture. Afterwards, extract the downloaded archive file in a folder of your choice, open up a terminal and change to appropriate directory where you extracted the android-ndk. In case of ndk-r8e:

cd ~/Downloads/android-ndk-r8e/

Afterwards, just run the sh-script in the following way which will install the standalone-toolchain of the defined Android-API level (--platform=android-9) in the folder of your choice (install-dir=/home/<username>/android/android-ndk-toolchain): For a 64-bit architecture run the following script:

sh build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=$HOME/android/android-ndk-toolchain --system=linux-x86_64

And for a 32-bit architecture:

sh build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=$HOME/android/android-ndk-toolchain 

Android-SDK:

In addition to the android-ndk-toolchain, we need the android-sdk for the compilation of Lapack which is described later on. Download and extract the Android-SDK to a folder of your choice e.g. /home/<username>/android/.

###2. Setting up buildenvironment

With terminal or command of your operating system, change your current directory to the folder where you want to clone ubitrack and run:

git clone https://github.com/Ubitrack/buildenvironment.git ubitrack
cd ubitrack

###3. Adding additional components as submodules There are several components represented by repositories which can be added as submodules to ubitrack. These components have to be placed in the <ubitrack>/modules folder. Usually you will need utcore, utvision, utdataflow, utfacade, utcomponents and utvisioncomponents:

Component Description Repository
utvisualization contains a standalone 3D rendering module. Mostly for quick visualizations and debugging https://github.com/Ubitrack/utvisualization.git
utvisioncomponents contains algorithms working on (mostly) camera images. https://github.com/Ubitrack/utvisioncomponents.git
utfacade contains frontend adapters for ubitrack dataflow networks. Also contains the utConsole. https://github.com/Ubitrack/utfacade.git
utdataflow contains the dataflow network and related graph methods. https://github.com/Ubitrack/utdataflow.git
utcore contains fundamental datastructures and algorithms. Needed by all other modules. https://github.com/Ubitrack/utcore.git
utcomponents contains basic dataflow modules. These cover most common tracking and registration cases. https://github.com/Ubitrack/utvisioncomponents.git
directshow contains MS Windows specific directshow framegrabber https://github.com/Ubitrack/directshow.git
buildenvironment contains general build scripts https://github.com/Ubitrack/utvisualization.git
You can pick the submodules manually or alternatively add all existing components at once by executing a script. ####3.a Manually adding submodules This example will create the \/module/utcore directory and add utcore as submodule.
git submodule add https://github.com/Ubitrack/utcore.git modules/utcore

####3.b Automized adding submodules <scripts that will do that for you in {YourDirectory}/misc/setup/[windows|linux]>

Ubitrack-Compilation for Windows:

For Windows open a Git- or Command-Console, change to the and execute

misc\setup\windows\addStandardModules.bat

Ubitrack-Compilation for Linux/Android on Linux:

In order to add all components, just execute the following script for linux:

sh misc/setup/linux/addStandardModules.sh

###4. Configure the needed libraries Ubitrack is based on the following libraries:

Mandatory

Optional

These libraries have to be downloaded and configured. In order to do that, there exist three possible ways, the first one described in 4.1 offers ready-to-use download packages and uses the Ubitrack library finder. The Ubitrack library finder needs all the libraries in one specific folder. 4.2 configures the libraries by the command line and in 4.3 each possible configuration and path is manually set by editing a textfile.

####4.1 Make use of the Ubitrack library finder

Ubitrack is able to find libraries which have a specific folder structure that looks like this:

<LibrariesDirectory>/[linux|windows|android]_[x64|x86]/LibraryName/[bin|include|lib|lib_debug]. 

An example for windows would be:

external_libraries\windows_x64\boost
external_libraries\windows_x64\boost\include
external_libraries\windows_x64\boost\lib
external_libraries\windows_x64\boost\lib_debug

The Ubitrack library finder will take all library files in the "lib" and "lib_debug" folders and link to their paths. So you have to separate the release and debug libraries in different folders.

Ubitrack Compilation for Windows

Ubitrack Compilation for Linux on Linux

Ubitrack Compilation for Android on Linux

Ubitrack-Compilation for Windows/Android/Linux:

If you have placed the libraries in a different folder to <ubitrack>/external_libraries, you have to specify the path where Ubitrack has to search for the libraries. This can be done by executing the following command in the <ubitrack> folder:

Windows example:

scons EXTERNAL_LIBRARIES=/home/user/path/to/all/external/libraries/

Linux example:

scons EXTERNAL_LIBRARIES=/home/user/path/to/all/external/libraries/

Alternatively, you can execute

scons

and afterwards add the following line manually to the <ubitrack>/config.cache file: Note: The first time this document may be empty.

Windows example:

EXTERNAL_LIBRARIES = '/home/user/path/to/all/external_libraries/'

Linux example:

EXTERNAL_LIBRARIES = '/home/user/path/to/all/external_libraries/'

Taking similar steps, you can easily extend Ubitrack with additional libraries for your own need.

####4.2 Configure the libraries using command line options and library finder

####4.3 Set everything by hand

###5. Compile Ubitrack

For the compilation of Ubitrack for Windows/Linux run:

scons install-all

For the compilation of Ubitrack for Android you have to specify the android-platform once. This configuration will stay until it is changed by e.g. PLATFORM=x64.

scons PLATFORM=android
scons install-all

Speed up the build process for parallel builds:

scons install-all -j{NumProcessors} 

Clean the build by calling:

scons -c

You can see all command line parameters by calling:

scons -h

Create a Visual Studio Project:

scons vcproj
Clone this wiki locally