-
Notifications
You must be signed in to change notification settings - Fork 236
Building Qt with PowerShell
jonwd7 edited this page Feb 20, 2014
·
32 revisions
[WIP]
This will guide you through using a PowerShell script to automatically download and compile Qt statically for you. There will be one script for MinGW and one for MSVC.
The install will default to C:\Qt\Static\{VERSION}\{PLATFORM}
(e.g. .\5.2.1\mingw48_32
or .\5.2.1\win32-msvc2012
)
- MinGW-build-Qt-Static.ps1 (PowerShell script) [Link forthcoming]
- MinGW installed to QTDIR\Tools\mingw*
- You can use MinGW-Builds-Install.exe to install any version you want to this path
- You can also install the latest version supported by the Qt Online Installer (Maintenance Tool.exe)
- MSVC-build-Qt-Static.ps1 (PowerShell script)
- MSVC 2012 or MSVC 2010
- Script arguments
-QtSrcUrl (Default: "http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.7z")
-QtRoot (Default: "C:\Qt")
-QtStaticDir (Default: "$QtRoot\Static")
-QtVersion (Default: "5.2.1")
-QtToolsDir (Default: "$QtRoot\Tools")
-NumJobs (Default: 12)
-MSVCVer (Default: win32-msvc2012)
- If using MSVC2010, pass in
-MSVCVer win32-msvc2010
- To change number of jobs for CPU, pass in e.g.
-NumJobs 8
(or your # of CPU cores)
- Install PowerShell 3.0 or 4.0
- Run PowerShell as Administrator
- Enter:
Set-ExecutionPolicy RemoteSigned
... and hit Return.
- Run the script.
- You do not need to pass in any arguments if using VS2012.
- See: Setting up PowerShell
- It will download the source package (5.2.1).
- It will extract the source package to
C:\Qt\src
. - For MSVC, it will import your environment using the VS Command Prompt BAT file. For MinGW it will find your install of MinGW and modify the environment paths.
- It will configure Qt, for example:
``` cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
-opensource -confirm-license ` -make libs -nomake tools -nomake examples -nomake tests" - It will compile Qt with N jobs where N = # of CPU threads. This will take anywhere from 1 hour to several hours.
- It will install Qt to
C:\Qt\Static\{VERSION}\{PLATFORM}
.
After it builds you can add the version manually inside Qt Creator at Tools > Build & Run > Qt Versions
See also: http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW