Build Qt without all the widgets I don't need
-
Hi,
I am using Qt for a really small project (just one window, a few push buttons and some other minor stuff). Still, I need the Qt-DLLs and ship them with my executable file (at least on Windows).
Now, my executable only is about 200 KB big, but the Qt DLLs (Core and GUI, bult in release mode) take almost 10 MB which is quite a lot since I don't need most of the stuff in there.
Is there a way of building Qt only with what I actually need and use in my application?
I know the wiki page http://qt-project.org/doc/qt-4.8/configure-options.html, but is there a way to optimize the size further?
Thank you in advance,
D. -
Yes, there are more options for optimization. There is a header file somewhere that has loads of defines that enable you to switch features on and off very specifically. I'll dig a bit to find it.
Edit:
Found it. You're looking to modify <qtdir>\src\corelib\global\qfeatures.h -
You can also define your own feature set using the qconfig tool. You can find it (as a project with sources) under "tools".
Consider that you can also remove a lot of features using the command line options of "configure", when building Qt. Call configure -h to get a full list of options.
-
[quote author="peppe" date="1331177864"]Have you tried to use static linking and LTO?[/quote]
Hey, thanks for your reply. Unfortunately because I can't afford the commercial license, static linking is no option. But what does LTO stand for?[quote author="Andre" date="1331177864"]Yes, there are more options for optimization. There is a header file somewhere that has loads of defines that enable you to switch features on and off very specifically. I’ll dig a bit to find it.
Edit: Found it. You’re looking to modify <qtdir>\src\corelib\global\qfeatures.h
[/quote]I'll have a look into that file, thanks a lot :) -
[quote author="Asperamanca" date="1331200410"]You can also define your own feature set using the qconfig tool. You can find it (as a project with sources) under "tools".
Consider that you can also remove a lot of features using the command line options of "configure", when building Qt. Call configure -h to get a full list of options.[/quote]qconfig seems to be very promising, didn't know that tool. Thank you!
-
There's also an article explaining the use of qconfig:
http://doc.qt.nokia.com/4.7-snapshot/fine-tuning-features.html