views:

160

answers:

3

I have a small piece of code that works as a plugin for a larger graphics application. The development platform is Qt with c++ code. I've managed to build a .so, .dylib and .dll for linux, MacOS and Windows respectively, but to do so I had to have a machine running each operating system (in my case, running linux [ubuntu] gcc natively, and windows MinGW and MacOS XCode gcc in virtual machines).

Is there a way to build for all 3 platforms from one? I beat my head against this problem a while back, and research to date suggests that it's not easily (or feasibly) done. The code only needs to link against a single header that defines the plugin API and is built from a fairly basic Makefile (currently with small variations per platform).

A: 

For Linux it is fairly easy to setup or even download a virtual machine using VMWare for instance. Getting OSX to run on VMWare is somewhat tricky but possible.

Running VMWare and sharing a directory on a local drive you can even compile for the different platforms using the same exact files.

There is somewhere a cross-compiler for OSX but I wouldn't trust it to be of great quality.

shoosh
Yes, that is what I've done so far.
Rog
OSX uses gcc, using a crosscompiler on linux to compile for OSX should get you pretty much the same thing.
tliff
+1  A: 

You should have a look at crosscompiling.

You basically build a compiler that (on your current plattform) will output binaries for your desired platforms.

Try this link about doing it on linux, for windows, with QT

tliff
A: 

Better late than never, I just came across IMCROSS

It looks quite promising!

Rog