Installation for MacOSX¶
Prerequisites for MacOSX users¶
If not already installed:
- Install Xcode
- Install git
- Install Python 2.7
- Install CMake. The minimal version required is 3.7 if you want to compile with precompiled headers (build twice faster, enabled by default). Otherwise you can use a 3.1 version.
- Install Ninja : to use instead of make.
For an easy install, you can use the Hombrew project to install missing packages.
$ brew install git
$ brew install python
$ brew install cmake
$ brew install ninja
For Openni dependency, you need libusb
$ brew install libusb-compat
If you are building the dependencies with the fw4spl-ext-deps additional dependencies, the VLC application is also needed.
$ brew cask install vlc
FW4SPL installation¶
FW4SPL uses CMake as build system.
We strongly recommend to build FW4SPL by separating source files, build files and install files. So we propose the following folders layout :
- Deps/Build/Debug
- Deps/Build/Release
- Deps/Src
- Deps/Install/Debug
- Deps/Install/Release
- Dev/Build/Debug
- Dev/Build/Release
- Dev/Src
- Dev/Install/Debug
- Dev/Install/Release
Of course you can name the folders as you wish, or choose a different layout, but keep in mind to not build inside the source directory. This is strongly discouraged by CMake authors.
Here are the details, if you need some help to create this folders hierarchy :
- Create a third party folder (Deps)
$ mkdir Deps
- Create into “Deps” the source, build and install directories
$ mkdir Deps/Src Deps/Build Deps/Install
- Create sub-folders to separate Debug and Release compilations
$ mkdir Deps/Build/Debug Deps/Build/Release Deps/Install/Debug Deps/Install/Release
- Then create a “Dev” directory, for FW4SPL
$ mkdir Dev
- Create into “Dev” the source, build and install directories
$ mkdir Dev/Src Dev/Build Dev/Install
- Create sub-folders to separate Debug and Release compilations
$ mkdir Dev/Build/Debug Dev/Build/Release Dev/Install/Debug Dev/Install/Release
Dependencies¶
We need first to build the third-party librairies. We will now fetch the scripts that allow to build them and then launch the compilation.
- Clone the repository into your source directory of Deps:
$ cd Deps/Src
$ git clone https://github.com/fw4spl-org/fw4spl-deps.git fw4spl-deps
Note
Optionnal: You can also clone this extension repository: fw4spl-ext-deps
You’ll need it if you want to add extension to fw4spl (like fw4spl-ar).
- Check if all the cloned repositories are on the same branch.
- Update the cloned repositories to the lastest stable tag.
- Go into your Build directory (Debug or Release) : here an example if you want to compile in DEBUG
$ cd ../../..
$ cd Deps/Build/Debug
Project configuration¶
To build the dependencies, you must configure the project with CMake into the Build folder. As any CMake based project, there are three different ways to perform that.
Note
All the generation options are specify in ‘Project generation’
1. Command-line¶
In this case, you give all the necessary variables on the command-line in one shot :
$ cd ~/Deps/Build/Debug
$ cmake ../../Src/fw4spl-deps -DCMAKE_INSTALL_PREFIX=~/Deps/Install/Debug -DCMAKE_BUILD_TYPE=Debug
Or, if you cloned the fw4spl-ext-deps :
$ cd ~/Deps/Build/Debug
$ cmake ../../Src/fw4spl-deps -DCMAKE_INSTALL_PREFIX=~/Deps/Install/Debug -DCMAKE_BUILD_TYPE=Debug -DADDITIONAL_DEPS=~/Deps/Src/fw4spl-ext-deps
2. NCurses based editor¶
This editor allows to set the required each variable in a more interactive way :
$ cd ~/Deps/Build/Debug
$ ccmake ../../Src/fw4spl-deps
Then change the following CMake variables:
CMAKE_INSTALL_PREFIX
: set the install location, here~/Deps/Install/Debug
CMAKE_BUILD_TYPE
: set the build type ‘Debug’ or ‘Release’ADDITIONAL_DEPS
: you can leave it empty, it is only needed if you have an extra source location like fw4spl-ext-deps or a custom repository.
Press “c” to configure.
3. Qt based gui¶
$ cd ~/Deps/Build/Debug
$ cmake-gui ../../Src/fw4spl-deps
Like ccmake, change the following CMake variables:
CMAKE_INSTALL_PREFIX
: set the install location, here~/Deps/Install/Debug
CMAKE_BUILD_TYPE
: set the build type ‘Debug’ or ‘Release’ADDITIONAL_DEPS
: you can leave it empty, it is only needed if you have an extra source location like fw4spl-ext-deps or a custom repository.
Click on “configure”.
Project generation¶
Set the following options (some of the options will be needed for the optional source):
ENABLED_INFINITAM
: set to ON to build infinitam.ENABLED_BUILD_ORB_SLAM2
: set to ON to build ORB Slam 2ENABLED_OGRE_DEPS
: set to ON to build ogre.ENABLED_PCL_DEPS
: set to ON to build PCL.ENABLED_REALSENSE
: set to ON to build librealsense.ENABLED_SOFA_DEPS
: set to ON to build sofa.ENABLE_EXPERIMENTAL_DEPS
: set to ON to build experimentals libraries.ENABLE_LIBSGM
: set to ON to build libSGM dependencies.ENABLE_ODIL
: set to ON to build Odil dependencies.ENABLE_OPENCV_CONTRIB
: set to ON to build OpenCV contrib extra modules.ENABLE_OPENCV_CUDA
: set to ON to build OpenCV with CUDA support.ENABLE_OPEN_MP
: set to ON to enable OpenMP.ENABLE_PCL_CUDA
: set to ON to build PCL with CUDA support.
Generate the code by pressing “g” on NCurses based editor or click on “generate” on gui.
Warning
Do not compile debug and release with the same Build and Install folders. If you followed the recommended folder layout, this should be fine.
Compilation¶
Now you can compile the FW4SPL dependencies with make in the console, it will automaticaly download, build and install each dependency.
$ make all
$ make install_tool
Warning
Do NOT use ninja to compile the dependencies, it causes conflict with qt compilation.
If you get compilation errors at this step, please ensure you installed all the requirements, especially those for Qt.
Source¶
- Clone fw4spl repository into your source directory:
$ cd Dev/Src
$ git clone https://github.com/fw4spl-org/fw4spl.git fw4spl
Note
- Optionnal: You can also clone these extension repositories:
- fw4spl-ar contains functionalities for augmented reality (video tracking for instance).
- fw4spl-ext contains experimental code.
- fw4spl-ogre contains a 3D backend using Ogre3D.
- Check if all the cloned repositories are on the same branch.
- Update the cloned repositories to the same tag as dependencies.
- Go into your Build directory (Debug or Release) : here an example if you want to compile in debug:
$ cd Dev/Build/Debug
- Now you have to configure the project. You can use one of the three tools explained above.
Also, for FW4SPL, we recommend to use the Ninja generator. It builds faster, and it is much better for everyday use because it is fast as hell to check the files you need to compile. In other words, with Ninja the compilation starts instantly whereas Make spends a dozen of seconds to check what should be compiled before actually compiling something. So if you plan to develop with FW4SPL, go with Ninja. If you only want to give a single try, you can live with the standard “Unix Makefiles” generator.
Project configuration¶
To build the dependencies, you must configure the project with CMake into the Build folder. As any CMake based project, there are three different ways to perform that.
1. NCurses based editor¶
To use make, here with ccmake
:
$ ccmake ../../Src/fw4spl
To use ninja :
$ ccmake -G Ninja ../../Src/fw4spl
- Change the following cmake arguments
CMAKE_INSTALL_PREFIX
: set the install location (~/Dev/Install/Debug or Release)CMAKE_BUILD_TYPE
: set to Debug or ReleaseEXTERNAL_LIBRARIES
: set the install path of the third party libraries you compiled before.(ex : ~/Deps/Install/Debug)PROJECT_TO_BUILD
: set the list of the projects you want to build (ex: VRRender, Tuto01Basic ...), each project should be separated by ”;”PROJECT_TO_INSTALL
: set the name of the application to install
2. Qt based gui¶
$ cd ~/Deps/Build/Debug
$ cmake-gui ../../Src/fw4spl-deps
Like ccmake, change the following CMake variables:
CMAKE_INSTALL_PREFIX
: set the install location, here~/Deps/Install/Debug
CMAKE_BUILD_TYPE
: set the build type ‘Debug’ or ‘Release’ADDITIONAL_DEPS
: you can leave it empty, it is only needed if you have an extra source location like fw4spl-ext-deps or a custom repository.
Click on “configure”.
- Change the following cmake arguments
CMAKE_INSTALL_PREFIX
: set the install location (~/Dev/Install/Debug or Release)CMAKE_BUILD_TYPE
: set to Debug or ReleaseEXTERNAL_LIBRARIES
: set the install path of the third party libraries you compiled before.(ex : ~/Deps/Install/Debug)PROJECT_TO_BUILD
: set the list of the projects you want to build (ex: VRRender, Tuto01Basic ...), each project should be separated by ”;”PROJECT_TO_INSTALL
: set the name of the application to install
Note
- If
PROJECT_TO_BUILD
is empty, all application will be compiled - If
PROJECT_TO_INSTALL
is empty, no application will be installed
Click on “generate”.
Note
To generate the projects in release mode, change CMake argument CMAKE_BUILD_TYPE
to Release
both for fw4spl and fw4spl-deps
Build¶
Then, according to the generator you chose, build FW4SPL with make :
# Adjust the number of cores depending of the CPU cores and the RAM available on your computer
$ make -j4
Or with ninja:
$ ninja
If you didn’t specify anything in PROJECT_TO_BUILD
you may also build specific targets, for instance:
$ ninja Tuto01Basic VRRender
Launch an application¶
After a successful compilation the application can be launched with the fwlauncher program from FW4SPL. The profile.xml of the application in the build folder has to be passed as argument to the fwlauncher call in the console.
$ bin/fwlauncher Bundles/MyApplication_Version/profile.xml
Example:
$ cd /Dev/Build/Debug
$ bin/fwlauncher Bundles/VRRender_0-9/profile.xml
Extensions¶
FW4SPL has two main extension repositories:
- fw4spl-ar: extension of fw4spl repository, contains functionalities for augmented reality (video tracking for instance).
$ cd Dev/Src
$ git clone https://github.com/fw4spl-org/fw4spl-ar.git fw4spl-ar
$ cd fw4spl-ar
- fw4spl-ogre: another extension of fw4spl, contains a 3D backend using Ogre3D.
$ cd Dev/Src
$ git clone https://github.com/fw4spl-org/fw4spl-ogre.git fw4spl-ogre
$ cd fw4spl-ogre
Note
Update the cloned repositories to the same tag as dependencies.
Then you have to reconfigure your CMake project:
$ cd ../../Build/Debug
$ ccmake .
Modify `̀ ADDITIONAL_PROJECTS`̀ : set the source location of fw4spl-ar and fw4spl-ogre separated by a semi-colon.
~/Dev/Src/fw4spl-ar/;~/Dev/Src/fw4spl-ogre/
Recommended software¶
The following programs may be helpful for your developments:
- IDE:
- Versioning tools: