10

I am a Qt/C++ developer. I would like to setup a continuous integration environment whereby after committing the source code, it triggers a build process that build the code for the 3 platforms I'm using:

  • Linux
  • OS X
  • Win32

If possible, how do I setup such environment. Any hints or links are welcome. I've read around about Jenkins, but I can't find any good tutorial for it.

2
  • May be the SVN system that you commit the source code to has an API that you can use to capture such events (like commit)?
    – badmaash
    Mar 28, 2012 at 10:09
  • 2
    This is not a programming question. It probably belongs on programmers.stackexchange.com
    – Gray
    Mar 30, 2012 at 18:23

5 Answers 5

4

I also suggest Jenkins for several reasons:

  • It will run on all of the platforms you listed.
  • It can be configured to start a build when the repository is updated (hint: configure the Job to "Poll SCM" and you won't have to muck with your SCM tool to get it to tell Jenkins to start building).
  • It provides good support (mostly through plugins) for Unit Testing. [You're project is doing unit testing, right?]
  • The price is right

A bigger issue is going to have is that AFAIK, Qt doesn't really do cross-compiling for other platforms well. Using Jenkins (and the appropriate plugins), you should be able to solve this.

One method that comes quickly to mind is to have an instance of Jenkins on each platform. Each instance is responsible for building the version for its own platform. At the end of the build, the created artifacts are all put into a common, shared location.

1
  • 5
    >[an instance of Jenkins on each platform] - Jenkins slave on each platform would be better - that way you have one central control, do not have to update each instance, artifacts are stored on master, etc. Mar 28, 2012 at 22:11
2

Jenkins supports this feature via plugins for all major source control systems. If you seriously considering using Jenkins (and I would highly recommend it), consider buying John Ferguson Smart's Jenkins: The Definitive Guide.

2

Two solutions coming to my mind:

BuildBot

BuildBot is a highly customizable continuous integration system written in Python. The master component offers a nice web-based GUI to monitor and trigger builds; slave components are put on the target machines (usually virtual machines but they could be the Mac laptop of one of the developers). Docs are good enough to build up a basic system, customization could be a little tricky (at least it was for me). Using commit/push hooks provided by VC systems you can easily activate the master and trigger builds across the slaves. It also supports incremental builds (a must if your project is big).

CDash

Developed by the authors of CMake, CDash is a web application collecting builds coming from across the network, not exactly what you asked for but I think it's worth a try. Very powerful if you have a team of developers who could continuosly submit build result on their machines to the server (and if you use CMake it's almost transparent). You cannot trigger builds from the server as Buildbot does, but you could setup a bunch of VM with a cron which checks for changes and in case performs the build and sends results to CDash

3
  • You meant BuildBot? I have to build my project with g++ on Unix and Mac but I think I'm using MSVC2008 to compile it under Windows. How is possible with BuildBot handle non-unix systems? I've prepared a virtual machine ready for the build under windows, but this approach it's error prone and not very automatic...
    – linello
    Mar 28, 2012 at 11:42
  • I use MinGW toolchain to build under windows using qmake, but we're planning to migrate to CMake which can handle VS projects. In both cases a BuildBot slave can perform the build.
    – Masci
    Mar 28, 2012 at 12:37
  • We use buildbot CI for cross-platform Qt development (Mac, Windows, Linux) and it works well (SVN and git repositories). Support for building different git branches could be better though. Mar 28, 2012 at 14:07
0

Sure it's possible. Most of the version control systems are able to execute custom script on server side. Some of them (git, for example), has hooks to achieve the same locally. Have a look at git's post-commit hook.

All you need is to create a script that will trigger cross-platform builds.

0

Most version control systems allow post-commit hooks to allow you to kick off events like builds. Alternatively build systems can be configured to regularly poll a source control repository and manage their own build scheduling (this is how we use Jenkins).

Something to bear in mind is how long it will take to do a complete build across platforms and the typical number of check-ins in that interval. You might find batching check-ins a better way of doing continuous integration builds if you have an fair sized team or limited build server resources. Otherwise your build system could quickly end up trying to play catch up.

As for whether it is possible to build on all target platforms, that depends on your tool chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.