WxWidgets Cross Compiling
for building graphical
applications. wxWidgets is a cross-platform C++ toolkit that
provides support for Graphical User Interface (GUI) design, files,
memory management, printer support and many more aspects of building
applications in a graphical environment. The toolkit is free to
download and to use, for both personal and commercial goals.Introduction
wxWidgets provides a very clean and well-documented class library. This is quite nice but not unique - other toolkits I worked with do that as well.The main thing that makes wxWidgets stand out is the fact that your source code will compile, without almost no modifications, on a number of major platforms:
- MS Windows
- Unix and Linux using X11, Motif or GTK as basis
- Apple Macintosh OS X
- Palm (in alpha quality)
Since my personal emphasis lies on developing embedded applications, I am not really a MS Windows or Apple Mac OS X guru. However, it is very nice to be able to provide my users (who almost all use MS Windows) with the same desktop application that connects to my embedded system without having the hassle of learning MS Windows.
Professional software development
For my company, I use the following set-up:- I develop my embedded software on FreeBSD. Having a Unix workstation for software development is the best money can buy - and FreeBSD is free, so even better.
- I design and test my desktop GUI also on FreeBSD. So, I do not need to switch between systems when developing software/hardware.
- I cross-compile my desktop application on FreeBSD to MS Windows
using the MinGW compiler. This allows me to use the same codebase and
the same makefiles that I would use under FreeBSD. The only difference
is that in the makefile, I set the compiler from gcc to mingw32-gcc
(and of course the other dev tools, but you get the point).
Cross-Compiler set-up
The following steps need to be taken to cross-compile on FreeBSD:- install Mingw32 through the ports system.
- download my WxWidgets compiled code tar ball. This includes all headers, libraries and dll files needed to compile your source code for win32.
- cd to /usr/local/mingw32 .
- untar the files by typing:
tar xvfz
wx2-6-2-mingw-msw-freebsd.tar.gz
- you can now cross-compile using mingw32. Don't forget to copy the dll files in the /usr/local/mingw32/lib to your MS Windows target system (usually to the Winnt\system32 directory , this depends on your Windows version).
- A typical cross-compile for Windows would look like:
mingw32-g++ -c
`/usr/local/ming32/bin/wx-config --cppflags` foo.cpp
mingw32-g++ `/usr/local/ming32/bin/wx-config
--libs` foo.o
In your makefile, the switch between using g++ and mingw32-g++ is easy to configure.