c++-gtk-utils

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

GTK versions

GTK-2, GTK-3 and GTK-4

As the tarball has been prepared, a call to './configure' will by default configure the library for GTK-3. However, if './configure-gtk2' or './configure-gtk4' is called, then the library will be prepared for compilation against GTK-2 or GTK-4 respectively.

To configure and compile for GTK-2, GTK version 2.10.0 or greater is required. To configure and compile for GTK-3, GTK version 2.90.0 or greater is required. Version 2.99.0 or greater is required for the Cgu::Application class to be compiled in. To configure and compile for GTK-4, GTK version 3.96.0 or greater is required.

The compilation default can be changed to GTK-2 by calling './bootstrap-gtk2.sh' or './bootstrap-gtk4.sh'. If so changed, to compile the library then against GTK-3 it is necessary to call './configure-gtk3'. To change the default back to GTK-3 again, call './bootstrap-gtk3.sh'.

However the default is set, the library can always be explicitly prepared for compilation against GTK-2 by calling './configure-gtk2', against GTK-3 by calling '/configure-gtk3' and against GTK-4 by calling './configure-gtk4'. It will therefore not generally be necessary to call bootstrap-gtk2.sh, bootstrap-gtk3.sh or bootstrap-gtk4.sh.

The library as compiled for GTK-2, GTK-3 and GTK-4 can be parallel installed. To configure a user program to link against the library as installed for GTK-2 use c++-gtk-utils-2-2.2.pc, to configure to link against the library as installed for GTK-3 use c++-gtk-utils-3-2.2.pc, and to configure to link against the library as installed for GTK-4 use c++-gtk-utils-4-2.2.pc. This 2.2 series of the library can also be parallel installed with the 2.0 and 1.2 series.

'make install' will also put the headers in different places: for the library as installed for GTK-2 these are in $prefix/include/c++-gtk-utils-2-2.2/c++-gtk-utils, for GTK-3 in $prefix/include/c++-gtk-utils-3-2.2/c++-gtk-utils and for GTK-4 in $prefix/include/c++-gtk-utils-4-2.2/c++-gtk-utils. The reason for this is that although the library headers themselves are at present identical in each case, the installed file cgu_config.h, which is produced when running './configure' and its siblings, might be different if different compilation options are chosen. This would allow, for example, the GTK-2 binary to be compiled to use glib memory slices, and the GTK-3 binary to be compiled to use the global new/delete operators. This separation also gives more scope for differentiation in the future, depending on how GTK-4 develops.

Although as mentioned above there are separate dynamic and static library installations for GTK-2, GTK-3 and GTK-4 at the binary and header level, they provide the same documentation (which is normally located in $prefix/share/doc/c++-gtk-utils/2.2). This means that if you run 'make uninstall' against, say, the tarball as configured for GTK-2, but want to retain the documentation for future use for GTK-3 applications, it will be necessary to run 'make install' again against the tarball configured for GTK-3. (So far as the distributions' packaging management utilities are concerned, it might be better for a single c++-gtk-utils package to have within it the binaries for both GTK-2 and GTK-3 where that distribution provides both GTK-2 and GTK-3, but if separately packaged the packaging utilities will handle the situation as files common to two packages will not be deleted unless both packages are removed.)

Building without GTK

From version 2.0.15, the library can be built with the --without-gtk configuration option. If built with this option, GTK is not required as a dependency: a build only requires glib support.

If this option is chosen, there is no difference between configuring with './configure-gtk2' (producing c++-gtk-utils-2-2.2.pc), './configure-gtk3' (producing c++-gtk-utils-3-2.2.pc) or './configure-gtk4' (producing c++-gtk-utils-4-2.2.pc): the end result will be the same, namely that the following classes will not be compiled into the library: Cgu::Application, Cgu::FilePrintDialog, Cgu::FilePrintManager, Cgu::MainWidgetBase, Cgu::TextPrintManager and Cgu::WinBase.

Note that the build system does not automatically choose the --without-gtk option if an appropriate version of GTK-2, GTK-3 or GTK-4 cannot be found. If GTK is not installed on the target machine, the --without-gtk configuration option must be explicitly chosen. Furthermore, the test suite will not be compiled if that configuration option is chosen.