wxGTK2 vs wxGTK3

127 views
Skip to first unread message

Igor Korot

unread,
Aug 18, 2015, 8:32:58 AM8/18/15
to wx-dev
Hi, (Paul),
If I'm configuring the library with "--with-gtk=3", I explicitely say
that I will
compile against the current GTK+3 headers. And therefore during configure
__WXGTK3__ will be defined.
However, __WXGTK__ (or __WXGTK2__) will not be defined in this case, but
it will be when I will use "--with-gtk=2".

Am I right?

Thank you.

Vadim Zeitlin

unread,
Aug 18, 2015, 2:09:24 PM8/18/15
to wx-...@googlegroups.com
On Tue, 18 Aug 2015 08:32:57 -0400 Igor Korot wrote:

IK> If I'm configuring the library with "--with-gtk=3", I explicitely say
IK> that I will compile against the current GTK+3 headers. And therefore
IK> during configure __WXGTK3__ will be defined. However, __WXGTK__ (or
IK> __WXGTK2__) will not be defined in this case, but it will be when I
IK> will use "--with-gtk=2".
IK>
IK> Am I right?

This is really simple to check. You have, presumably, already built wxGTK3
so all you have to do to write something like this:

#ifdef __WXGTK__
#error __WXGTK__ is defined
#else
#error __WXGTK__ is not defined
#endif

and compile (or just preprocess) it.

Regards,
VZ

Igor Korot

unread,
Aug 19, 2015, 12:13:59 AM8/19/15
to wx-dev
Vadim,
I extended it a little and here is what I got:

igor@IgorDellGentoo ~/wxWidgets.patched/buildGTK3/samples/minimal $ make
/home/igor/wxWidgets.patched/buildGTK3/bk-deps g++ -c -o
minimal_minimal.o -D__WXGTK__ -I../../../samples/minimal
-DWXUSINGDLL -I../../../samples/minimal/../../samples -Wall -Wundef
-Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual
-D_FILE_OFFSET_BITS=64
-I/home/igor/wxWidgets.patched/buildGTK3/lib/wx/include/gtk3-unicode-3.1
-I../../../include -pthread -I/usr/include/gtk-3.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz
-I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread
-I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -pthread
-I/usr/include/webkitgtk-3.0 -I/usr/include/gtk-3.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz
-I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16
-I/usr/include/libsoup-2.4 -I/usr/include/libxml2
-I/usr/include/webkitgtk-3.0 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -DWX_PRECOMP -pthread -ggdb -O0 -pthread
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread
-I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz
-I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-fvisibility=hidden -fvisibility-inlines-hidden
../../../samples/minimal/minimal.cpp
../../../samples/minimal/minimal.cpp:43:2: error: #error __WXGTK__ is defined
#error __WXGTK__ is defined
^
../../../samples/minimal/minimal.cpp:50:2: error: #error __WXGTK20__ is defined
#error __WXGTK20__ is defined
^
../../../samples/minimal/minimal.cpp:53:2: error: #error __WXGTK3__ is defined
#error __WXGTK3__ is defined
^
Makefile:184: recipe for target 'minimal_minimal.o' failed
make: *** [minimal_minimal.o] Error 1

And so I take it __WXGTK20__ is defined for GTK+-2+, i.e. GTK+ version 2.0.0+.

This looks kind of weird:
There are __WXGTK__, __WXGTK2__, __WXGTK20__ and __WXGTK3__.

I think it's too much...

Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
Aug 19, 2015, 6:17:05 AM8/19/15
to wx-...@googlegroups.com
On Wed, 19 Aug 2015 00:13:58 -0400 Igor Korot wrote:

IK> This looks kind of weird:
IK> There are __WXGTK__, __WXGTK2__, __WXGTK20__ and __WXGTK3__.

I don't see where does __WXGTK2__ come from, the only mentions of it I see
are in the VMS-specific files. __WXGTK__ and __WXGTK3__ are definitely
logical. We took the decision to still define __WXGTK20__ for GTK+ 3
because it used to be used for checking for "GTK+ > 1.x" and it makes sense
to compile the code using such checks when using GTK+ 3 as well because
it's much closer to GTK+ 2 than to 1.

Regards,
VZ
Reply all
Reply to author
Forward
0 new messages