views:

558

answers:

7

My primary OS is Linux, but now I'm forced to write some C++ applications for Windows. I was thinking about developing on the Linux box with cross platform libraries like WxWidgets (and some care about other platform dependencies) and then cross compiling the result to mingw target.

So the tools I'm thinking of using are

  • g++ for compilation and cross-compilation.
  • CMake
  • WxWidgets
  • ??? for making windows installer packages
  • wine for testing of the windows version

And my questions:

  1. What are some free (or even better open source) installers for Windows that I might use to create the final package? It would help if the package could be prepared from Linux.

  2. Will Wine be enough to test the cross compiled version (after all the logic is tested in the Linux version)?

  3. Is this a good idea? :-)

+11  A: 

Check Qt too, its a very rich crossplatform framework.

As for installers I'd highly recommend Wix

For testing it will be much better to use some kind of virtualization like SUN VirtualBox. I believe you could use trial version of Windows or Windows 7 RC which is free to use until March 2010.

Ray
+2  A: 

1 - InstallJammer allows you to create installers for *nix and Windows. Not sure if it allows cross creation of installers (i.e. Creating Windows installers from *nix). A commercial option with demo available to try is the Bitrock InstallBuilder.

2 - Maybe... If you have a Windows license Dav's suggestion would be better.

3 - If it helps you work better/more efficiently & effectively, sure.

Keep us posted on how you get on - this is interesting.

John Barrett
+2  A: 

2) No, Wine as it says is not Windows, you can not reliably test it like that. I suggest running a Virtual machine in your Linux, that will make your work much smoother.

3) It sounds possible, for the graphical aspect I would also consider GTK+ which was used for GIMP, and works much the same on Windows and Linux.

Liran Orevi
+1  A: 

You imply that the applications are for Windows only and not cross-platform, in which case I think the answer to 3. - This is really not a good idea - trumps the rest.

The reason being you are going to have to extensively test the application under Windows anyway, either directly or in a virtual instance. That being so you're better to develop under the target OS because you're more likely to produce a better application - both from catching the bugs earlier and more thoroughly and ensuring your application 'works' for your users. I certainly wouldn't trust just Wine.

I'm not a big fan of cross-platform widgets. Like Java applications you generally end up with something that doesn't quite look right, and like the uncanny gap that can be enough to make your application smell bad to a large section of your users. Even at the slightly more abstract level, each OS's applications have a slightly different feel as to how they work and you'll most likely end up with a Windows application that feels like a, say, KDE one, which will again put your users off.

So yes, certainly possible to do this, but probably not the optimal approach from point of view of the quality of the end product. To do so will give yourself something of a handicap with what you produce and I'd say that's likely to offset the convenience to you of using a Linux platform. Actually I'd be surprised if you manage even that because I'd bet you'll spend more time messing around with the widgets trying to fine-tune them so they work right under real Windows than you'll gain from using an unfamiliar Windows toolset.

Cruachan
+2  A: 

First of all, yes it is good idea. I have several project that I maintain their Windows version in this way.

In any case I would suggest you to test the final product on Windows machine. If you have a license for Windows OS, you may use visualization to do final tests.

I'd suggest to use Autotools that has very good cross compilation support and works "natively" with a cross compiler.

Under Debian for example running

./configure --host=i586-mingw32msvc

This would create the correct cross compilation makefile as if this was Unix project.

In any case, I would recommend to develop a cross platform version and time-to-time test native Windows version with Wine/Windows by cross compiling them.

Artyom
+1  A: 

You will need a MSDN licence anyway to get access to all the multitude of versions of windows you'll want to test on.

You'll want to install the test OSs on VMs. This could be on your Linux desktop, but a dedicated box might be better.

I don't know how many versions of windows you plan on supporting, but you should definitely test on all of them. Wine is not windows, nor is Windows XP the same as Vista, Windows 7 etc. There are also a lot of different distributions and languages of Windows, some of which you should undoubtedly test on.

By all means develop on Linux. By all means use cross-platform widgets (yes, these are good). But you'll still need your MSDN licence so you can install test OSs.

MarkR
A: 

NSIS, the Nullsoft Scriptable Install System can be compiled under Linux and used to produce install binaries for Windows. The instructions are here. Read the general section, and the section for building on POSIX.

I use this to produce installs for a few projects.

Evan
I really find NSIS to be a bad thing.After working or better trying to work with NSIS a couple of days, I feel pain everywhere...It doesn't report errors(nothing like writing a log of everything including errors and commands that did not succeed), variable assignments and usage seems unclear to me. No real fun.
Henning
I use Inno Setup and it is truly the best.
George Edison