Thursday, April 2

Week 2: QT Static Compilation

The project's coming along nicely this week. I finished porting my pure C++ STL-reading code over to Qt (the cross-platform GUI framework), first of all, integrating everything into one application. I think this will be easier to manage than using two programs as I had originally envisioned. In any case, I can now duplicate last week's feat with a GUI:

Integrated GUI and STL file management
But I spent much more time on something a little more under-the-hood: QT deployment. Once I finish my application, I want to compile it to a single executable file for simplicity of use. Unfortunately, neither the Qt library nor the Qt IDE, Qt Creator, support this use out-of-the-box. Instead, as shipped, they require one to provide the end user with the executable and a host of compiled QT libraries, which makes for a bulky installation. The only upside is that this allows easy plugin and upgrade management - but I need neither of those. Thus I had to recompile the QT toolchain for "static" executable compiling, i.e., my program and all Qt libraries will be put into a single exe. The file will be larger, but easier to use. Here's how to do it, following instructions from here.

1) Download Qt with MinGW and install. Make sure to add the MinGW environment in the installation.

2) You'll also need Windows PowerShell 3.0 or higher and 7-Zip.

3) Download this Windows PowerShell script.

4) Now, the default Windows setting is that PowerShell scripts are not allowed to run. Follow this guide to allow execution of the script.

5) Run the script; it'll take a few hours to gather all its resources and execute. You'll now have a statically compiled Qt distribution.

5) To use this static Qt distribution, follow along with the rest of the aforementioned tutorial.

And that's it. So I now have a statically compiled version of Qt, ready to deploy my 3D printer driver anywhere. Next week? Some math and algorithms sound in order.