Developing OpenViBE using Qt Creator

  • NB: concerns OpenViBE 0.16.0 and later

NOTE: Using Qt Creator is an advanced way to build OpenViBE. More basic build mechanisms are recommended for new OpenViBE users.

These instructions have been mainly written for Qt Creator on Linux. Some specific notes for Windows have been made here.

With the new build system using CMake for all the heavy lifting it is now possible to use any IDE capable of understanding CMake projects to develop openvibe in integrated manner.

One of the most polished tools for C++ development on linux is the Qt Creator which, contrary to its name, is a general purpose IDE and does not only serve to develop Qt applications.

Setting everything up

The new build system has made it quite easy to use the native building capabilities of any IDE. Still, some tweaks will be necessary to make everything work.

CMake

Openvibe now uses CMake (almost) exclusively to create a build environment. Since Qt Creator has a native support for CMake projects it makes importing very easy.

Run Qt Creator, choose Open File or Project… and in the dialog navigate to the CMakeLists.txt file in the openvibe root.

A dialog will open, prompting you to run the CMake process. To this you will need to provide additional arguments:

 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=OPENVIBE_ROOT/dist

Do not forget to change the OPENVIBE_ROOT path to location where you put your openvibe files.

Building application

By default, Qt Creator will run make on build and make install before run. This might not be the ideal behavior for openvibe development since the install process can be a bit lengthy. Better way to proceed is to use make install for compiling and skip the compile step entirely before running.

In order to do this go to Projects (on the left) -> Build&Run -> Build. Click on the Details button in build steps and add install as an additional argument to make.

qt-creator-build

Then go to Tools->Options->Build&Run->General and un-check the Always build before deploying it and Always deploy before running it steps.

qt-creator-deploy

Running application

In order to be able to run applications directly from the Qt Creator you will need to set up a few environmental variables for each run setting.

qt-creator-settings

Go to Projects (on the left)->Run. Select the application for which you want to set the run environment. There are several things to change. First you need to change the working path to the /bin folder in the /dist folder made during the install. Change it to:

OPENVIBE_ROOT/dist/bin

Then you will need to set up the environment. The build system makes it so you have a very few of them to set manually. Hint: you can use the batch edit button to edit the variables more easily:

LD_LIBRARY_PATH=OPENVIBE_ROOT/scripts/software/lib:OPENVIBE_ROOT/dist/lib
OV_DISTROOT=OPENVIBE_ROOT/dist

If you are interested in using the Clean Environment instead of the system one, you will also need to set these two up:

DISPLAY=:0
HOME=/home/YOUR_HOME

What you get

Qt Creator has a lot to offer in terms of features.

Semantic code highlighting and full code-completion

As any other respectable IDE, Qt Creator has a parser providing a very good semantic code highlighting and excellent code-completion capabilities. All of this is also very fast.

qt-creator-completion

Git integration

The nice thing is that Qt Creator also works with Git tools that allow you to use a lot of functionality (blame, commit, amend …).

Visual debugging

The best improvement is that you can use the visual debugger with all of the features right out of the box without any tinkering.

qt-creator-debugging

In order to do this you have, of course, to build the software in Debug mode. In order to do this you will have to re-run the CMake with these arguments:

 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=OPENVIBE_ROOT/dist

Note that it is actually easier on Linux to only ever build the Debug version.

You can also use the Valgrind profiler directly from the IDE.

Windows specific notes

For Windows, the environment doesn’t typically contain the variables set required by the OpenViBE build. Especially the build doesn’t know where to find the dependencies. Hence you need to use a launcher. The easiest way is to modify scripts/win32-launch-vc.cmd to call the Qt Creator .exe instead of launching Visual Studio. Other than that, the description on this page should also work on Windows (with small modifications possibly required). You can use the CMake version provided by OpenViBE dependencies installer and it is located in dependencies/cmake/bin/.

This entry was posted in Developer documentation, Development, Instructions, Source code handling and tagged , , , , . Bookmark the permalink.