Ticket #13902 (closed enhancement: fixed)
Fixed wxGTK/Windows build with Visual C++ and MinGW
| Reported by: | kosenko | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | wxGTK | Version: | |
| Keywords: | Cc: | vaclavslavik, kosenko | |
| Blocked By: | Patch: | yes | |
| Blocking: |
Description
I have fixed wxGTK build under Windows using Visual C++ and MinGW compilers with Win32 (not X11) backend.
I have tested in Visual C++ 2008 and MinGW/cmd.exe GCC 4.5.2 under Windows XP SP3.
wxGTK port under Windows can be useful:
A) to get same widgets behavior under Linux and Windows (GNOME look&feel under Windows)
B) for applications under Windows that have strong GTK+ third party dependencies
C) for debugging under Windows wxGTK-based applications
Key changes:
- __WXMSW__ macro was replaced with __WINDOWS__ one where it was required in non-GUI code. It is because of wxGTK is not based on wxMSW widgets.
- Bakefiles was modified with same approach as wxUniv port. It looks ugly but it works.
- Two *.c files was renamed to *.cpp ones because of Visual C++ has problems with mixing C and C++ in PCH.
- I have used Windows Resources (RC) instead of XPM because first it is included in executables and it is native under Windows. Also I have added wxHAS_RESOURCE_FILES macro to indicate if current platform supports resource files.
- Disabled some features:
- WebView/GTK+ (wxWebView) and GStreamer(wxMediaCtrl) looks like not implemented under Windows.
- wxGLCanvas, wxUIActionSimulator and partially keyboard handling has strong dependencies on X11 code.
- Enabled some Windows features: DIB, Dialup and OLE Automation.
You can build wxGTK/Windows port in the same way as wxUniv one:
- Set WXGTK=1 in command line tools (mingw and nmake)
- Select "GTK+ Debug" in Visual C++
I have used following GTK+ binaries:
http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.8-20111122_win32.zip
Before compilation you need to add include folders:
<you_gtk_path>\include\gtk-2.0
<you_gtk_path>\include\glib-2.0
<you_gtk_path>\include\cairo
<you_gtk_path>\include\pango-1.0
<you_gtk_path>\include\gdk-pixbuf-2.0
<you_gtk_path>\include\atk-1.0
<you_gtk_path>\lib\glib-2.0\include
<you_gtk_path>\lib\gtk-2.0\include
and libs folder: <you_gtk_path>\lib
wxGTK under Windows uses gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib glib-2.0.lib, this libs is linked automatically using bakefiles.
Latest source codes is available in
https://github.com/kosenko/wxWidgets/tree/gtkwin

