IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Qt for Windows - Building from Source

Configuring and building Qt for Windows.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Qt for Windows - Building from Source▲

This page describes the process of configuring and building https://. To download and install a pre-built Qt for Windows, follow the instructions on the https:// page.

Step 1: Getting the Sources▲

Qt sources can be installed in Qt Online Installer. Source packages are also available as https://, as archives in the https:// (commercial users), and on https:// (open-source users).

If you install the sources through Qt Online Installer, they will be available in the Qt installation directory, for instance C:\Qt\6.6.3\Src.

If you downloaded the source archive, extract it to a directory of your choice, for instance C:\dev\Qt\src.

The path to the source directory must not contain any spaces or Windows-specific file system characters. The path should also be kept short. This prevents issues with too long file paths in the compilation phase.

Step 2: Installing Build Requirements and Set Environment▲

To build Qt from sources you need a build environment with a supported compiler and various build tools.

Build Tools▲

Tool

Supported Versions

Description

CMake

Version 3.16 and newer (3.17 and newer for -debug-and-release builds 3.21 and newer for -static builds).

Required for configuring the Qt build. Available in Qt Online Installer and on https://.

Ninja

-

Recommended tool for building Qt. Available in Qt Online Installer and on https://.

Python

Version 3

Required build tool. Windows installers are available on https://, or from the https://.

The executables cmake.exe, ninja.exe, and python.exe must be available in your build environment. Add the respective directory to your PATH environment variable.

Compilers▲

The following compilers and configurations are supported in Qt 6.6:

Operating System

Architecture

Compiler

Windows 10 (1809 or later)

x86_64

MSVC 2022, MSVC 2019, MinGW 11.2

 

Windows 11

x86_64

MSVC 2022, MSVC 2019, MinGW 11.2

 

Windows on ARM

arm64

MSVC 2019/2022

Technology Preview

Windows on ARM is only supported as a deployment target. Applications have to be cross-compiled from an x86-64 Windows machine and deployed to target.

QDoc Dependencies▲

QDoc uses Clang to parse C++ code. If you wish to build QDoc manually, refer to Installing Clang for QDoc for specific build requirements.

Setting the Environment▲

For MSVC, do one of the following:

  • Run the vcvarsall.bat:

     
    Sélectionnez
    "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64
  • Search on the Windows search bar for the VS Native Tools command prompt.

For MinGW: Add MinGW to PATH environment variable:

 
Sélectionnez
Set PATH=C:\qt\tools\mingw1120_64\bin;%PATH%

Step 3: Building the Qt Libraries and Tools▲

To configure your build, create a build directory and run the configure.bat script in this directory:

 
Sélectionnez
mkdir C:\dev\qt-build
cd C:\dev\qt-build
C:\dev\Qt\src\configure.bat

By default, Qt is configured for installation in the C:\Qt\Qt-6.5.3 directory. This can be changed by using the -prefix option. See the list of https:// to tweak further.

Then build the libraries and tools:

 
Sélectionnez
cmake --build . --parallel

Period after --build means current folder.

After building, you need to install the libraries and tools in the desired path (unless you enabled a https://:

 
Sélectionnez
cmake --install .

Step 4: Using Qt▲

After Qt is installed, you can start building applications with it.

If you work from the command line, consider adding the Qt tools to your PATH environment variable as follows:

 
Sélectionnez
set PATH=C:\Qt\Qt-6.5.3\bin;%PATH%

If you plan to use Qt from an IDE, you need to register the Qt version explicitly there. For Qt Creator, see https://.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.