qiBuild documentation

Parsing toolchain feedsΒΆ

Let’s assume you have a cross-toolchain updated to http://example.com/packages/foo-ctc.tar.gz, a binary package in http://example.com/packages/bar.tar.gz, and an XML feed looking like:

<toolchain>
  <package
    name="foo-ctc"
    url="http://example.com/packages/foo-ctc.tar.gz"
    toolchain_file="cross-config.cmake"
  />
  <package
    name="bar"
    url="http://example.com/packages/bar.tar.gz"
  />

accessible in http://example.com/feeds/cross.xml

And you run

$ qitoolchain create cross-foo http://example.com/feeds/cross.xml

See qitoolchain.feed for how XML parsing is done.

After every package has been parsed and added to the toolchain, it is just a matter of toolchain.update_toolchain so that the toolchain file is regenerated.

The toolchain file will then look like:

# Autogenerted file
include("/path/to/a/ctc/cross-config.cmake")
list(INSERT CMAKE_FIND_ROOT_PATH 0 "/path/to/a/ctc")
list(INSERT CMAKE_FIND_ROOT_PATH 0 "/path/to/a/package")

and cross-foo will be added to the name of the known toolchains.

Then, when using

$ qibuild configure -c cross-foo my_project

A qibuild.toc.Toc object will be created, containing a qitoolchain.toolchain.Toolchain because cross-foo is a known name.

Then, a build directory name build-cross-foo will be created, and cmake will be called, as if you had type:

$ cd ~/src/my_project/
$ mkdir build-cross-foo
$ cmake -DCMAKE_TOOLCHAIN_FILE=~/.cache/qi/toolchains/cross-foo.cmake ..

And everything will just work:

You will go through the cross-config.cmake, so the compiler to use will be properly set, and you will have a entry in CMAKE_FIND_ROOT_PATH to where the bar package has been extracted, so finding bar libraries from the bar package will also work.