2017-04-15

Build C++/Qt5 application on TravisCI

TravicCI is a brilliant idea with a shaky (IMO) execution.



The concept is simple enough; create a .travis.yml file with some markup to describe the building of your project, add said file to the root of your git repo, push.

In the other end, travis hooks into your repo (github) and detects the push and starts building your project according to the definition in your .yaml

And it works great for a lot of people, but after spending more than 2 hours with Travis you will know that it has it's limitations, especially if your language or platform is not of the hipster variety.



Since Travis is free for open-source projects it has become popular. This is a really sound business strategy, by capturing the hearts of passionate programmers, you will get sales when the weekend is over and they go back to work.

However, many users means lots of focus on operations, plenty of long wishlists and less time/opportunity for innovation/implementation.

And it shows. My experience with having Travis build OctoMY has been a mixed bag. It turns out that Linux support in Travis is "Beta" and is centered around Ubuntu 14.04 which as the name suggest is 3 years old (at the time of writing). If that was not bad enough, Ubuntu has very conservative collection of C++ compilers in the official repository which means that the only C++ compiler available in Travis does not support C++14.

Crazy right?

Further, Ubuntu, even after signing a deal with digia, has even more ancient versions of Qt in the repos. And you can forget support for multiple versions of Qt side by side.

OK, enough whining and on to what you came here for!

I managed to muster my inner zen-patience-plus-determination combo and I ended up confirming that you too can have your favorite version of Qt and your favourite version of clang++ or g++ building your project happily on Travis CI in Ubuntu Travis 14.04LTS.

At first this sounds wonderful, but please note that the resulting binaries are pretty tied to that platform, and unless you have a server side application (rare for Qt) running on Ubuntu 14.04 this will not really be useful other than to verify that your code builds and to run the tests.

So with no further ado, here is the link to the fully working travis yaml for building Qt5/C++14 applications.




No comments:

Post a Comment