Building Qt5 for Windows
-
Hi!
I downloaded and installed "qt-windows-opensource-5.0.1-mingw47_32-x86-offline.exe" (even the source components) and compiled a tiny test-project to find out that the final .exe would depend on tons of .dlls which together would take up about 30+ mb diskspace.
As I'm planning to make a small application I would like to get rid of some of those dependencies and I read that you could build Qt yourself without ICU and such. Is this correct?
How do I build Qt myself? I have read "http://qt-project.org/wiki/Building-Qt-5-from-Git":http://qt-project.org/wiki/Building-Qt-5-from-Git but I get confused by all that other Linux/Mac OS X stuff.
Do I have to build from Git, or can I use the sources that came with the installer?
Help is very much appreciated!
-
- you can build from git or .zip package from Qt Project. Don't use sources from offline SDK, they are included for reference only. Building from git is the best option (imo) as it allowes to clean the code for a rebuild, and to fetch newer code at will. But it's your call. If this is the first time you will be building Qt, then you can be sure you will have to rebuild because you will do something wrong. I did that dozens of times and still keep forgetting some stuff some times
- you can build without ICU with -no-icu passed to configure
- I'm not too familiar with Windows, but make sure you use jom to compile, and instruct it to use as many threads as possible - Qt is big, it takes a long time to compile (2 cores - about 5 hours. 4 cores + HT - about 30 minutes). You can delete QtWebKit folder if you want to skip it's build - it takes really long
-
It would be my first time, yes. I'm pretty new to both C++ and Qt and I haven't really had to set up stuff yet as everything has worked "out of the box" so to speak.
I've read the wiki page again, and this is what I've understood so far:
- Install QtCreator + mingw (without the pre-built stuff, or?)
- Install Python and Perl
- Add Python and Perl to PATH (and Qt?)
- Get the source (as .zip if I do not wish to use git?)
- Configure build (configure -release -nomake examples -nomake tests -confirm-license?)
- Make (jom? no clue about this)
- Set up QtCreator to use my build
Is this totally wrong? Am I missing something (except the make command)?
-
- install Qt Creator as a last step (precompiled 2.6.2 should be fine), it will pick up most stuff automatically. MinGW of course goes first
- jom is a Qt replacement for nmake. I think it's used by default, but not sure
- yeah, .zip is for Windows, tar.gz for Unix
- apart from that you are right. It might be necessary to have Ruby for QtWebKit, too, but I don't know. I don't use web kit currently.
-
I don't think I will need QtWebKit.
I will give this a shot, thank you very much for your help!
EDIT:
Okay, so I configured it like following:
@configure -release -opensource -shared -nomake examples -nomake tests -opengl desktop -platform win32-g++ -no-icu@
Then I ran "mingw32-make" instead of using "jom" and it's compiling now I guess. :)
Are there any more stuff than ICU that you don't need? I want to make it as lightweight as possible.
EDIT 2:
It took some time but it seemed to work! Thanks again! :)