Building Qt 6 from Git: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
Line 60: Line 60:
Qt 6 is now built with CMake. The configure script from Qt 5 times still exists, but is now just a wrapper around CMake.
Qt 6 is now built with CMake. The configure script from Qt 5 times still exists, but is now just a wrapper around CMake.


See [https://github.com/qt/qtbase/blob/dev/cmake/README.md] for details on how to configure and build Qt 6 with CMake.
See [https://github.com/qt/qtbase/blob/dev/cmake/README.md cmake/README.md] in the sources for details on how to configure and build Qt 6 with CMake.

Revision as of 13:09, 8 October 2020

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

This article provides hints for checking out and building the Qt 6 repositories. This is primarily for developers who want to contribute to the Qt library itself, or who want to try the latest unreleased code.

If you simply want to build a specific release of Qt from source to use the libraries in your own project, you can download the source code from the Official Releases page or the Archive. Alternatively, commercial customers can download the Source Packages via the Qt Account portal.

To compile Qt Creator, see Building Qt Creator from Git.

To compile Qt 5, see Building Qt 5 from Git

System Requirements

All desktop platforms

  • Git (>= 1.6.x)
  • CMake (>= 3.16)
  • Ninja
  • Perl (>=5.14)
  • Python (>=2.6.x)
  • A working C++ compiler, supporting at least C++ 17

Getting the source code

First clone the top-level Qt git repository:

$ git clone git://code.qt.io/qt/qt5.git

or (if you're behind a firewall and want to use the https protocol):

$ git clone https://code.qt.io/qt/qt5.git

Then check out the target branch (see Branch Guidelines). Currently, the only branch that exists for Qt 6 is dev, but in the future this will change, allowing to e.g. check out sources from 6.1

$ cd qt5
$ git checkout 6.1

Getting the submodule source code

As described in the README.git, initialize the repository using the init-repository script, which clones the various sub-modules of Qt 6.

Relevant options for init-repository:

  • --module-subset=default,-qtwebengine : Consider skipping the web module (Qt WebEngine) by passing this option. It is quite big and takes a long time to compile (and is often a source of compile errors), so it is recommended to only download it if you intend to use it. You can always re-run init-repository later on to add it.
  • --branch : Check out the branch tips instead of the SHA1s of the latest successful integration build.
  • --codereview-username <Jira/Gerrit username> : If you plan to contribute to Qt, you may specify your codereview username (pay attention to capitalization!) so that the git remotes are properly set up. Note that it is recommended to adjust your ssh configuration instead.
$ cd qt5
$ perl init-repository

In order to build a specific release of Qt, you can checkout the desired tag:

$ cd qt5
$ git checkout v6.0.0
$ perl init-repository

Configuring and Building

Qt 6 is now built with CMake. The configure script from Qt 5 times still exists, but is now just a wrapper around CMake.

See cmake/README.md in the sources for details on how to configure and build Qt 6 with CMake.