9
votes

I am developing an application using QtCreator in Mac OS X and it must be cross-platform.

I have a Mac OS X as host. Also I have a MS Windows installed on virtual machine and a Ubuntu installed on another virtual machine:

  • Mac OS X: Qt 5.4.0 - 64bit - clang - Xcode 6.0
  • MS Windows: Qt 5.3.0 - 32bit - VC++ 2013
  • Ubuntu: Qt 5.3.0 - 64bit - GCC

How can I develop my application in Mac OS and build it in another platforms (Mac/Windows/Ubuntu) all at once?

Is there any remote compiler option in QtCreator?

2
In my last place, we had a cross compile environment. I had a different make file per target architecture (which means a different .pro file). You'll need a compiler that can compile for the target architectures AND any 3rd party libraries compiled for each platform. Our environment got big. AFAIK, QtCreator does not support this out of the box (but that's a guess). Our environment was setup for C++ compilation in general, not just Qt. Note that we had no Windows targets. Only *nix. - kiss-o-matic
Since you already have Virtual Machines containing the Qt build environment for the given OS, simply connect each one to Git, and when you need to build your changes, pull them from the remote repository to the virtual machine, then compile them on that VM. - sashoalm
@sashoalm, this is very manual! I look for an automated solution. - S.M.Mousavi
@S.M.Mousavi I understand that, it's just that I doubt a good solution exists. I'll bet in the end setting up the automated solution would require so much research and setting up it will end up costing you time not saving. - sashoalm
Thank you @sashoalm any way :-) - S.M.Mousavi

2 Answers

11
votes

I use remote compilation from Windows. I created custom build step using plink, which lest me execute remote command using key authorization, which starts the build. Qt creator can even parse errors returned :)

Short instruction how to configure it:

  1. Create public key authentication for your user in putty and configure connection to your server: https://www.howtoforge.com/how-to-configure-ssh-keys-authentication-with-putty-and-linux-server-in-5-quick-steps

  2. Download plink: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  3. In your QtCreator project configure "Custom Process Step" to connect to your server and start compilation. Assuming you have:

    • putty session to your build server configured and named CentOS7_local
    • user usename
    • project located in user home directory called projectname You can use something like (if you need some more sophisticated build start you can create a bash script on server and invoke it):

enter image description here

6
votes

I don't think you can remote compile in Qt Creator but you can use a continuous build system like Jenkins to setup a distributed build environment. Build slaves in all your VMs would compile on commit in your SCM like git or Subversion.

Advantages of this approach:

  • works on all major platforms like Linux, MacOS, Windows
  • .. and for all major compilers
  • you can build on any number of platforms regardless of Qt Creator support
  • you can get help easily because this is done in many professional systems
  • you can distribute your development
  • you can use any IDE
  • you have great flexibility and tons of plugins which make life easy

Note: There are many more CI systems out there, see here.