Here I describe a Qt4 setup for static linking the libraries in order to
distribute executables on Windows platform, with no DLL dependencies.
First of all, download and install the Qt SDK for Windows (LGPL) version,
which is based on MinGW.
Lets say that we install it on K:\Qt.
While developing our applications it's wise to use the shared
(DLL) Qt configuration, because it has faster build time.
Moreover, I won't even configure the static Debug mode because
it produces huge (>100 MB) executables! The static Release mode
is just fine.
(BTW, I switch to static Release mode only if I have to
test it, or, of course, when it's time to release it.)
Make a copy of K:\Qt\2010.02.1\qt
and name it K:\Qt\2010.02.1\qt_static.
Our static configuration takes extra space, but who cares?
Now copy K:\Qt\2010.02.1\bin\qtenv.bat and put it in
K:\Qt\2010.02.1\qt_static as
configure_static.cmd.
Modify it to match the below shell script:
@echo off
set INCLUDE=
set LIB=
set QTDIR=%CD%
set PATH=%CD%\bin
set PATH=%PATH%;%CD%\..\bin;%CD%\..\mingw\bin
set PATH=%PATH%;%SystemRoot%\System32
set QMAKESPEC=win32-g++
configure -release -static -platform win32-g++ -nomake examples -nomake demos -no-exceptions -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -qt-libjpeg -qt-zlib -qt-libpng
echo run "mingw32-make sub-src" to build core Qt libraries only.
Before executing it we need to modify some configuration parameters.
Open K:\Qt\2010.02.1\qt_static\mkspecs\win32-g++\qmake.conf (text file) and edit
QMAKE_CFLAGS_RELEASE = ... to
QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer
Now, open the command line console, jump in qt_static folder and
run configure_static.cmd.
As soon as configure is finished, run mingw32-make sub-src
to build everything except examples and demos. A plain mingw32-make
will build everything, but that would be a waste of our time.
Notes:
References:
GoMLX: ML in Go without Python
-
In the previous post I talked about running ML inference in Go through a
Python sidecar process. In this post, let's see how we can accomplish the
same t...
12 hours ago
No comments:
Post a Comment