Managing dependencies between projects¶
In this tutorial, you will learn how to manage dependencies between projects.
We will assume you have a properly configured qiBuild worktree, and that you have managed to compile a basic project.
We are going to create two separate projects:
hello depends on the compiled library found in
world project contains sources to build a dynamic library
hello project contains source to build an executable named
which depends on the
It also contains a small test that simply tries to launch
The sources of this example can be found here:
Extract the archive in your qiBuild worktree, you should end up with something looking like:
.qi |__ qibuild.xml world |__ qiproject.xml |__ CMakeLists.txt |__ world |__ world.hpp |__ world.cpp hello |__ qiproject.xml |__ CMakeLists.txt |__ main.cpp
qiBuild in action¶
Configuring and building the hello project is as easy as
$ qibuild configure hello $ qibuild make hello $ qibuild test hello
For this to work, you only have to write two
The first one in
QI_WORK_TREE/world/qiproject.xml simply tells
qibuild that there is a project named
<project version="3"> <qibuild name="world" /> </project>
The second one in
there is a project named
and that it depends on the
<project version="3" > <qibuild name="hello"> <depends buildtime="true" runtime="true" names="world" /> </qibuild> </project>
You can see that configuring
hello caused the
world project to be
configured too, and that building
hello also built the
On Windows, the
world DLL was copied right next to
qibuild test hello just worked.
If you are using Visual Studio, you can open
QI_WORK_TREE/hello/build-.../hello.sln, select “hello” as startup project,
and start debugging hello_d.exe right away.
If you try to compile hello in release, you’ll get an error because “world” has not been compiled in release, so world.lib could not found.
$ qibuild configure --release world $ qibuild make --release world
And try again.