Re: Switching GTK version
- Date: Tue, 22 Aug 2017 17:15:37 -0300
- From: salsaman <salsaman@xxxxxxxxx>
- Subject: Re: Switching GTK version
You can also force gtk+ 2.x by passing --disable-gtk3 as a configure flag.
Meson is new to me, but here is what I do in my configure.ac.The fragment below checks for various versions of GTK+ and glib and sets appropriate variables.
HAVE_GTK_VERSION3=false AC_ARG_ENABLE( gtk3, [ --disable-gtk3 Disable gtk+ 3.x and compile with gtk+ 2.x] , disable_gtk3=yes) if test "x$disable_gtk3" != "xyes" ; then echo -n "checking for GTK+ >= 3.0.0... " PKG_CHECK_EXISTS([gtk+-3.0 >= 3.0.0],[HAVE_GTK_VERSION3=true],[HAVE_GTK_VERSION3=false]) if test "x$HAVE_GTK_VERSION3" = "xfalse"; then echo "no" else PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0) fi else echo "Not checking for gtk+ 3.x" fi if test "x$HAVE_GTK_VERSION3" = "xfalse"; then echo -n "checking for GTK+ >= 2.4.0... " PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0) PKG_CHECK_EXISTS([gtk+-2.0 >= 2.16.0],[HAVE_GTK_VERSION216=true],[HAVE_GTK_VERSION216=false]) PKG_CHECK_EXISTS([gtk+-2.0 >= 2.6.0],[HAVE_GTK_VERSION206=true],[HAVE_GTK_VERSION206=false]) echo "- Compiling with gtk+ 2.x -" else GTK3_VERSION=`$PKG_CONFIG --modversion gtk+-3.0` echo "- Compiling with gtk+ version " $GTK3_VERSION " -" PKG_CHECK_EXISTS([gtk+-3.0 >= 3.10.0],[HAVE_GTK_VERSION310=true],[HAVE_GTK_VERSION310=false]) PKG_CHECK_EXISTS([gtk+-3.0 >= 3.11.0],[HAVE_GTK_VERSION311=true],[HAVE_GTK_VERSION311=false]) HAVE_GTK_VERSION216=true HAVE_GTK_VERSION206=true if test "$HAVE_GTK_VERSION310" = "true"; then if test "$HAVE_GTK_VERSION311" = "false"; then GTK310_WARN=true fi fi fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) PKG_CHECK_EXISTS([glib-2.0 >= 2.14.0],[HAVE_GLIB_VERSION214=true],[HAVE_GLIB_VERSION214=false]) PKG_CHECK_EXISTS([glib-2.0 >= 2.4.0],[HAVE_GLIB_VERSION24=true],[HAVE_GLIB_VERSION24=false])
On Tue, Aug 22, 2017 at 5:07 PM, Link Dupont <link@xxxxxxxxxxx> wrote:
On Tue, 2017-08-22 at 15:48 -0400, Igor Korot wrote:
> Hi, ALL,
> I have setup to do my development for GTK+2 and GTK+3 on 2 different
> My project is on GitHub and there is one codebase.
> What's the best way to set up Makefiles?
You're going to find this is a matter of opinion. Traditionally, GTK+
and GNOME projects have used GNU autotools for their build system. Many
are now moving to meson. Either way, I suggest you take some time and
learn one or both in order to make an informed decision about which
build system is best for you.
Meson is relatively new, and has most of its documentation on its
website. GNU autotools has a vast online manual available,
however I recommend reading "Autotools: A Practition's Guide to to GNU
Autoconf, Automake, and Libtool" to get a hands-on understanding of
the autotools suite.
You could, of course, eschew all of those and use your own hand-
maintained Makefile. You'll find varying levels of opinion there too,
although you'll encounter some pretty compelling arguments against
maintaining your own hand-crafted Makefiles anywhere you look. In this
case, you could consider at least using pkg-config to find out whether
your required libraries are installed and where they are located on
your build host.
gtk-list mailing list
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list