Slow Compilation of Small Projects

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Slow Compilation of Small Projects

R0b0t1
Hello,

The example at https://developer.gnome.org/gtkmm-tutorial/stable/sec-basics-simple-example.html.en
compiles very slowly. I attempted to make some improvements, mainly
not including gtkmm.h but instead including only gtkmm/window.h.
However, compilation is still very slow, taking a number of seconds.
Is it the linking step? Is there anything I can do to speed
compilation?

Build:

g++ -std=gnu++1z -Wall -pedantic `pkg-config gtkmm-3.0 --cflags --libs` \
    -o gtktest gtktest.cc


Program:

#include <gtkmm/window.h>

int
main(int argc, char *argv[])
{
    auto app = Gtk::Application::create(
            argc, argv, "org.gtkmm.examples.base"
    );

    Gtk::Window window;
    window.set_default_size(200, 200);

    return app->run(window);
}
_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Slow Compilation of Small Projects

Daniel Boles
If I had to guess, I'd say this was due to the, IMO weird, way that GTK+ and GLib forbid direct inclusion of any header except their top-level one, which then includes every other. <gtkmm/enums.h> includes <gtk/gtk.h> and hence the rest. <gtkmm/widget.h> includes <gtkmm/enums.h>. You can guess the rest...

Separate from that, though, I'd ask: what kind of compile times did you expect instead? e.g. based on which other libraries of comparable scale?


_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Slow Compilation of Small Projects

R0b0t1
Hello,

On Sun, Oct 22, 2017 at 8:16 PM, Daniel Boles <[hidden email]> wrote:
> If I had to guess, I'd say this was due to the, IMO weird, way that GTK+ and
> GLib forbid direct inclusion of any header except their top-level one, which
> then includes every other. <gtkmm/enums.h> includes <gtk/gtk.h> and hence
> the rest. <gtkmm/widget.h> includes <gtkmm/enums.h>. You can guess the
> rest...
>

Okay. I understand why that might have been done, but it seems like it
would be useful to design around it if possible.

> Separate from that, though, I'd ask: what kind of compile times did you
> expect instead? e.g. based on which other libraries of comparable scale?
>

Most small C files, up to fairly large multi-project files, will
compile nearly instantaneously even when linked against complex
projects. I realize C++ is vastly more complicated, but I remember
compilation being similar in a lot of cases.

It could be that GTK+ is exceptional. If so that is fine, but I think
it would be wise to consider improvements as time permits.

Cheers,
     R0b0t1
_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list