[CMake] Cross compiling using MSVC via wine on linux

Toni Timonen ttimonen at movial.fi
Sat Jan 6 11:11:10 EST 2007


On Sat, Jan 06, 2007 at 12:03:34PM +0100, Stefan Buschmann wrote:

> I'm setting up a make system for a fairly large project (game engine) 
> with cmake, and for the linux builds everything works really fine. But 
> now I would also like to do the compilation of the linux and windows 
> build on a daily base on the same machine, so cross compiling becomes 
> necessary. 

> It would not be too hard to do this with mingw, but most 
> users of the engine will use VC and there seem to be some problems 
> sharing dll/lib files between compilers (and the project has many 
> dependencies), so I want to use VC7 with wine to compile the project. 
> VC7 via wine is already working nice, and I can already compile the 
> project by hand without any problems.

Yeah, the incompatilibites with msvcr{t,60,70,71,..} is PITA. Also c++
ABI is incompatible.

My solution has been to compile everything using mingw. Most of the
dependencies are (atleast in my case FOSS) stuff, so they are easiest
to compile with gcc anyways.

I'm using cmake with scratchbox to compile software to other
platforms. The windows support of scratchbox is a work in progress but
enough for my use. It uses wine as a cpu-transparency method so
running windows-binaries as native-looking way is possible (try-run
stuff works) eg. I can compile GTK from scratch with it.
The environment is conceptiually similar to cygwin (or closer to
msys), but the platforms are inverted (we are having windows-behaving
environment inside linux box with all native GNU tools) with the
difference is that you can run linux-programs too.


> Would it be possible to seperate platform and compiler informations, so 
> that I could tell cmake to use VC compiler options even though we are 
> currently running on a linux machine? 

Few months ago I gave few patches to for cmake to get it
creating dlls correctly while being compiled for linux/scratchbox. That has been
enough to have it working, but the concept of using VC with
mingw/msys/cygwin/scratchbox -like system could be an asset for me too.

-- 
Toni Timonen
040-5111863,GPG 0x7984A4FD


More information about the CMake mailing list