-
Notifications
You must be signed in to change notification settings - Fork 120
Windows MSVC Static Build Guide
- Git for windows
- Perl (I recommend ActivePerl)
- Python
- VC++ core desktop features and tools (get through Visual Studio Installer)
- Search for "Edit the system environment variables"
- Click "Environment Variables..." at the bottom right
- In the bottom "System variables" pane, select "Path" and click "Edit..."
- Click "New" and add your QtCreator bin folder (Default
C:\Qt\Tools\QtCreator\bin
)
Please ensure that Perl and Python are in your path as well!
For this guide, you should use one of the following
64-bit: x64 Native Tools Command Prompt for VS 20XX
32-bit: x86 Native Tools Command Prompt for VS 20XX
To start, get the latest stable OpenSSL source through git
git clone https://github.com/openssl/openssl.git
And switch to the latest stable branch (as of the time of writing, it is OpenSSL_1_1_0-stable
)
Replace <LATEST_STABLE_BRANCH>
with the latest stable branch
git checkout <LATEST_STABLE_BRANCH>
Configure OpenSSL (make sure you have perl installed and in path)
Replace <OPENSSL_DIR>
with your desired installed openssl location
64-bit: perl Configure VC-WIN64A no-shared threads --prefix=<OPENSSL_DIR> --openssldir=<OPENSSL_DIR>
32-bit: perl Configure VC-WIN32 no-shared threads --prefix=<OPENSSL_DIR> --openssldir=<OPENSSL_DIR>
If you built before already, clean old files before building again
nmake clean
Build OpenSSL using nmake (jom doesn't work as of the time of writing)
nmake
Install OpenSSL
nmake install
First, get the Qt source code through git
git clone https://github.com/qt/qt5.git
And switch to the latest stable branch (as of the time of writing, it is 5.11.1
)
Replace <LATEST_STABLE_BRANCH>
with the latest stable branch
git checkout <LATEST_STABLE_BRANCH>
Next, fetch the actual files for each Qt module (big download)
perl init-repository
There are a few things to change here, so pay attention.
-
-prefix
is the folder for the build, if you want to use my structure, replace<YOUR_QT_VERSION>
with your version and<ARCH>
with "x64" or "x86" - Replace
<OPENSSL_DIR>
with the directory of the openssl you built previously - If using
OpenSSL < 1.1.0
, change-llibssl -llibcrypto
to-llibeay32 -lssleay32
.
configure -prefix C:\Qt\<YOUR_QT_VERSION>\Static_<ARCH> -platform win32-msvc -release -static -ltcg -nomake examples -nomake tools -nomake tests -openssl-linked OPENSSL_LIBS="-llibssl -llibcrypto" -I <OPENSSL_DIR>\include -L <OPENSL_DIR>\lib
Select your license and agree to the terms, and make sure OpenSSL was linked properly
If you want to run the configure command again (including if it fails), make sure to run git submodule foreach --recursive "git clean -dfx"
to remove all old files.
If you built before already, clean old files before building again
jom clean
Build Qt statically using jom (replace # with processor's thread count) (this will take a very long time)
The architecture of the Qt you build is the same as your Native Tools Command Prompt
jom -j #
Install static Qt to your desired folder
jom install