Building a project

Simple build

Let’s assume you only want to compile your project once.

Doing so is easy:

$ qibuild make foo

Or, to build in release, use:

$ qibuild make --release foo

Using an IDE

qiBuild is based on CMake, which in turns knows how to generate project files for many of IDEs : XCode, Eclipse, Visual Studio.

Here we are only dealing with the details for:

  • QtCreator on Mac and Linux
  • Visual Studio on Windows.

qiBuild is known to work fine with these IDEs, there may be some work to do to be able to use XCode or Eclipse. Patches and tutorials welcome !

qiBuild and QtCreator

The only thing to remember is that you should not let QtCreator call CMake by itself the first time.

Use qibuild configure then qibuild make to be sure everything works fine.

Then open the root CMakeLists in qtcreator.

You will be prompted to use a build directory:

../../_images/qtcreator-build-location.png

Warning

Do not use the default one proposed by QtCreator, choose the one that was created by qiBuild

QtCreator will read the settings from the existing build directory, so everything should work fine.

Remember to use the same CMake generator in QtCreator and in your configuration file, if qtcreator asks you to choose one.

Note: If QtCreator does not ask you for a build directory, one way to force it do to so is to delete the CMakeLists.txt.user file.

../../_images/qtcreator-hello.png

qiBuild and Visual Studio

When you have run qibuild configure, you will have a .sln file generated in your build directory.

../../_images/visual-hello.png

Note

To start debugging your executable, you have to select the matching project as ‘startup project’. The default ‘ALL_BUILD’ project is only used internally by CMake.

../../_images/visual-set-as-startup.png

Apart from the default startup, your solution should already be properly configured. Please avoid making changes to the solution file by hand, they will be lost the next time you change a CMake file or run CMake. To keep your project cross-platform and sharable with others you are strongly advised to use your CMakeLists.txt to make any changes to your solution. After each change of your CMakeLists.txt, run qibuild configure to update your solution file.

Note

The .sln generated by CMake is also capable to run CMake to re-generate itself. This sadly does not always work, so if you experience trouble, it’s best to close the project, then re-run qibuild configure , qibuild make by hand

Using Aldebaran packages

See: Using Aldebaran packages