-
Notifications
You must be signed in to change notification settings - Fork 0
Ubitrack Compilation for Windows
##1. Introduction
This wiki page will explain the instructions which are needed in order to compile Ubitrack from source for Windows. It contains the installation of the required build-tools, the setup of the buildenvironment and introduces the three methods to configure the needed libraries.
##2. How to install build-tools
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
##3. Setting up the buildenvironment
With the windows command line, change your current directory to the folder where you want to clone ubitrack and execute:
git clone https://github.com/Ubitrack/buildenvironment.git ubitrack
cd ubitrack
##4. Adding the Ubitrack submodules
As explained in Home, Ubitrack consists of several submodules. In order to add them, there are two possibilies: Executing a bash script which adds all submodules automatically or adding them manually.
###4.a Automized adding submodules
Open a Git- or Command-Console, make sure you are in the <ubitrack> directory and execute:
misc\setup\windows\addStandardModules.bat
By that, all submodule folders are created in <ubitrack>/module/ and the source files are downloaded.
###4.b Manually adding submodules
This example will create the <ubitrack>/module/utcore directory and add utcore as submodule. Therefore, you have to execute
git submodule add https://github.com/Ubitrack/utcore.git modules/utcore
inside the <ubitrack> directory.
##5. Downloading and Configuring the required libraries
As already mentioned, there exist three ways to configure the required libraries. The first uses the Ubitrack library finder which needs all the libraries in one specific folder and represents the easiest way. The second, configures the libraries by the command line and gives you the ability to set the include, lib and lib_debug paths of each library. In the third method, each possible configuration and path is manually set by editing a textfile which is automatically generated if you have chosen the first or second method.
###5.1 Downloading and Configuring the required libraries - the easy way
If you are running Windows with Visual Studio 10, you can download the following ready-to-use library packages and extract them e.g. in the <ubitrack> folder or in an other folder of your choice:
This results in a structure that should look for example like this:
<ubitrack>\external_libraries\windows_x64\
<ubitrack>\external_libraries\windows_x86\
However, if you have a different version to Visual Studio 10, you can use Lapack, OpenCV and Freeglut from the archive file above. For Visual Studio, have a look at the prebuilds which are can be downloaded from the official Boost-Website. Alternatively, you can have a look at PointClouds. After you have downloaded and extracted Boost, you have to copy the headers, libs and dlls to the approproate directories.
In the following example the boost setup installed boost to C:\boost_1_55_0. To refer easily refer to your external_libraries folder set the path to this folder as a local variable, e.g.:
set external_libraries=C:\mylibraires
This examples uses the paths for Windows 64-bit, Boost 1.5.5 and Visual Studio 11.0. For other Boost or Visual Studio versions you also have to change the source-folder. Alternatively, you can use the Windows Explorer to create the folder boost-folder structure and copy the *.dll, *-vc110-mt-1_55.lib and *-vc110-mt-gd-1_55.lib to appropriate boost folders or have a look at 5.2 where a full example is given how to set the paths directly to the C:\boost_1_55_0 subfolders to avoid copying files.
xcopy "C:\boost_1_55_0\boost" "%external_libraries%\windows_x64\boost\include\boost\" /S /E
xcopy "C:\boost_1_55_0\lib64-msvc-11.0\*.dll" "%external_libraries%\windows_x64\boost\bin\" /S /I /Y
xcopy "C:\boost_1_55_0\lib64-msvc-11.0\*-vc110-mt-1_55.lib" "%external_libraries%\windows_x64\boost\lib\" /S /I /Y
xcopy "C:\boost_1_55_0\lib64-msvc-11.0\*-vc110-mt-gd-1_55.lib" "%external_libraries%\windows_x64\boost\lib_debug\" /S /I /Y
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:
scons EXTERNAL_LIBRARIES=%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.
EXTERNAL_LIBRARIES = 'C:\\mylibraires\\'
Note: If you do not need Boost for other applications, you can uninstall the copy of Boost which was installed by Boost installer.
###5.2 Configure the libraries using command line options and library finder
In this method, the library configuration is done by appending parameters to a scons call similar to the previous section. This method gives you the ability to define your own library-folder structure as you may already have installed some of the libraries in different directories. Just like in the previous section, you can write the parameters into a <ubitrack>\config.cache document, alternatively. If you have not already downloaded the libraries, yet, have a look at section 5.1. where some download sources are mentioned.
The basic syntax for these parameters looks like this:
<LIBNAME>_<PARAMERTER>_<PLATFORM>_<CONFIGURATION>
Examples:
<LIBNAME>:
- BOOST, OPENCV, LAPACK, GLUT
<PARAMETER>:
- INCLUDEPATH (path to include files)
- LIBPATH (path to library files)
- LIBS (comma separated list of library files to link against)
- DEFINES (C++ defines passed to the compiler )
<PLATFORM>:
- x64 (64bit)
- x86 (32bit)
- android (armeabi-v7a)
<CONFIGURATION>:
- RELEASE (in this case empty)
- DEBUG
Full Example for the Boost (x64, Visual Studio 11) library configuration by a scons call:
scons BOOST_INCLUDEPATH=C:\boost_1_55_0 BOOST_LIBPATH=C:\boost_1_55_0\lib64-msvc-11.0 BOOST_LIBPATH_DEBUG=C:\boost_1_55_0\lib64-msvc-11.0
Full Example for the Boost (x64, Visual Studio 11) library configuration by editing <ubitrack>\config.cache:
BOOST_LIBPATH = 'C:\\boost_1_55_0\\lib64-msvc-11.0'
BOOST_INCLUDEPATH = 'C:\\boost_1_55_0'
BOOST_LIBPATH_DEBUG = 'C:\\boost_1_55_0\\lib64-msvc-11.0'
More examples for library configurations by a scons call:
scons OPENCV_LIBS="opencv_stitching242.lib, opencv_legacy242.lib"
scons BOOST_LIBPATH_X86_DEBUG='C:\\boost_1_55_0\\lib86-msvc-11.0'
###5.3 Set everything by hand
Run the scons command once in the <ubitrack> directory. After that, the library configurations are stored in <ubitrack>/config/configStorage. Edit the files and set Include/Library paths and libraries to link against.
Set havelib to true and add "HAVE_{LIBNAME}" to CPPDEFINES:
havelib = true
cppdefines = ["HAVE_LAPACK"]
Example:
[x64_release]
havelib = true
cpppath = ["C:\\mylibraires\\freeglut\\freeglut-2.8.0\\include"]
libpath = ["C:\\mylibraires\\freeglut\\freeglut-2.8.0\\lib\\x64"]
libs = ["freeglut.lib"]
cppdefines = ["HAVE_GLUT"]
##6. 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