Building-Qt-Creator-Packages: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==General Building of Qt Creator==
[[Category:Tools::QtCreator]]


# It is recommended to build in a shadow build directory
==Building Packages==
# <code>qmake $SOURCES/qtcreator.pro <span class="caps">CONFIG</span>+=release” “<span class="caps">DEFINES</span>+=IDE_REVISION=$GIT_COMMIT” “<span class="caps">QTC</span>_PREFIX=/qt-creator-x.y.z”</code> where <code>$GIT_COMMIT</code> should be the sha1 of the commit that you build, and where the <code><span class="caps">QTC</span>_PREFIX</code> is the directory prefix used for the 7zips that are created by the bindist target (see below).
# set the following environment variables:
## <code><span class="caps">INSTALL</span>_ROOT</code>: changes the location for the install dir when doing <code>make install</code>, e.g. <code>$BUILDDIR/install/qtcreator</code> (not used on Mac)
## <code><span class="caps">INSTALL</span>_EDITION</code>: can be set to e.g. <code>-opensource</code>, used for 7z and dmg file names, <code>$${PLATFORM}$(<span class="caps">INSTALL</span>_EDITION)-$${QTCREATOR_VERSION}$(<span class="caps">INSTALL</span>_POSTFIX)</code>
## <code><span class="caps">INSTALL</span>_POSTFIX</code>: used for 7z and dmg file names, <code>$${PLATFORM}$(<span class="caps">INSTALL</span>_EDITION)-$${QTCREATOR_VERSION}$(<span class="caps">INSTALL</span>_POSTFIX)</code>
# <code>make</code>
# <code>make docs</code>
# <code>make install</code> (don’t use on Mac)
# <code>make install_docs</code> (don’t use on Mac)
# <code>make deployqt</code>


After these calls the <code><span class="caps">INSTALL</span>_ROOT</code> (Windows/Linux) or <code>$BUILDDIR/bin/Qt Creator.app</code> (Mac) contains a distributable binary build.
Generally, if you want to build Qt Creator for development purposes, this is described in its [https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/README.md README.md]. The basics boil down to
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja "-DCMAKE_PREFIX_PATH=/path/to/Qt;/path/to/llvm" /path/to/qtcreator_sources
cmake --build .
If you want to build packages, we provide a [https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/scripts/build.py convenience script], that builds Qt Creator, installs the different components (Qt Creator, documentation, debug info, development package), deploys Qt and other dependencies into it, and zips them together.
python /path/to/qtcreator_sources/scripts/build.py --src /path/to/qtcreator_sources --build /tmp/qtc-build --qt-path /path/to/Qt --llvm-path /path/to/llvm
The script has options for some more things like turning of parts, or tweaking the CMake call. The script is used for our official binary packages, the GitHub build and CI. If you want to or need to build packages more directly, see the sections below.


To add “external” executables (jom, qtcreatorcdbext64) that we deploy for Windows builds to your install, call
== CMake Variables ==
 
{| class="wikitable"
# <code>make deployartifacts</code>
|CMAKE_PREFIX_PATH
 
|Used to find all dependencies like Qt, LLVM, elfutils, Python, and yaml-cpp, KSyntaxHighlighting (though we also ship sources for the latter two).
To create a 7zip with the binary build, call
|-
 
|Python3_EXECUTABLE
# <code>make bindist</code><br /> That packages the files with a directory starting with the <code><span class="caps">QTC</span>_PREFIX</code> you set in the qmake call.
|If your CMake finds a Python 2 executable, you need to point it explicitly to Python 3. Used for wizard translations only.
 
|-
To create a 7zip that can be used for installers, that directly contains the files without additional directory prefix (i.e. directly bin/, lib/, and so on), call
|CMAKE_BUILD_TYPE
 
|As usual, consider using RelWithDebInfo and setting QTC_SEPARATE_DEBUG_INFO=ON.
# <code>make bindist_installer</code>
|-
 
|QTC_SEPARATE_DEBUG_INFO
To create actual Qt Creator-only installers, you need to have the installer framework binaries installed, then
|Set the build type to RelWithDebInfo and this variable to ON, to get a separate target that installs debug information.
 
|-
# set the following additional environment variable:
|BUILD_WITH_PCH
## <code><span class="caps">IFW</span>_PATH</code>: location where <code>make installer</code> looks for the installer framework binaries (i.e. its bin/ and lib/ directories)
|Set to ON to enable building Qt Creator with PCH, improving compilation speed if you are not using something like a persistent ccache.
# <code>make bindist_installer installer</code>
|-
 
|WITH_DOCS
To create a disk image (dmg) with the <code>Qt Creator.app</code> on Mac, call
|Set to ON to add documentation build targets.
 
|-
# <code>make dmg</code>
|BUILD_DEVELOPER_DOCS
 
|Set to ON to add developer documentation to documentation build targets. Requires WITH_DOCS=ON.
==Things affecting the build/install==
|-
 
|SHOW_BUILD_DATE
===Environment Variables===
|Enable the build date in Help > About Qt Creator. Will of course break reproducible builds.
 
{| class="infotable line"
| <span class="caps">INSTALL</span>_ROOT
| Changes the location for the install dir when doing <code>make install</code>, e.g. <code>$BUILDDIR/install/qtcreator</code> (not used on Mac), installation is done into <code>$(<span class="caps">INSTALL</span>_ROOT)$$QTC_PREFIX</code>
|-
|-
| <span class="caps">INSTALL</span>_BASENAME
|IDE_REVISION
| Sets the base name used for the files created by make bindist, bindist_installer, dmg and dmg_installer. Defaults to <code>qt-creator-$${PLATFORM}$(<span class="caps">INSTALL</span>_EDITION)-$${QTCREATOR_VERSION}$(<span class="caps">INSTALL</span>_POSTFIX)</code>
|Set to ON to add a revision string in Help > About Qt Creator. Also set IDE_REVISION_STR for the actual string. Optionally set IDE_REVISION_URL to make the string clickable, opening the specified URL.
|-
|-
| <span class="caps">INSTALL</span>_EDITION
|WITH_TESTS
| Can be set to e.g. <code>-opensource</code>, used for default <span class="caps">INSTALL</span>_BASENAME
|Set to ON to build (but not install) tests.
|-
|-
| <span class="caps">INSTALL</span>_POSTFIX
|PYTHON_LIBRARY & PYTHON_INCLUDE_DIR
| Used for default <span class="caps">INSTALL</span>_BASENAME
|For building Python-enabled CDB support on Windows.
|-
|-
| <span class="caps">IFW</span>_PATH
|BUILD_PLUGIN_...
| Location where <code>make installer</code> looks for the installer framework binaries (i.e. its bin/ and lib/ directories)
|Set to OFF to disable building a specific plugin. Does not do dependency checking.
|-
|-
| <span class="caps">INSTALLER</span>_ARCHIVE
|BUILD_QBS
| This overwrites the default value of the 7z filename which is used by the bindist_installer step, including file extension.
|Set to OFF to disable building Qbs together with Qt Creator, even if you checked out the submodule or use a source package that includes it.
|}
|}


===Qmake Variables===
== CMake Targets ==
 
{| class="wikitable"
{| class="infotable line"
|cmake --build /path/to/build
| <span class="caps">QTC</span>_PREFIX
|Builds Qt Creator
| directory prefix for the install directory <code>make install</code> and for what is packaged with <code>make bindist</code>, must start with a <code>/</code>, e.g. <code>/qt-creator-x.y.z</code>, installation is done into <code>$(<span class="caps">INSTALL</span>_ROOT)$$QTC_PREFIX</code>
|-
|cmake --build /path/to/build --target docs
|Builds user manual. Also builds developer documentation if BUILD_DEVELOPER_DOCS is ON.
|-
|cmake --install /path/to/build --prefix /path/to/qtc-install --strip
|Installs and strips Qt Creator.
|-
|-
| <span class="caps">IDE</span>_PACKAGE_MODE
|cmake --install /path/to/build --prefix /path/to/qtc-install --component Dependencies
| Disables building the HellWorld and UpdateInfo plugins (which are built but marked experimental otherwise)
|Deploys dependencies (Qt, LLVM, elfutils) into the installation directory.
|-
|-
| <span class="caps">UPDATEINFO</span>_ENABLE
|cmake --install /path/to/build --prefix /path/to/qtc-install --component qch_docs
| Enables the UpdateInfo plugin and enables it for the build (usually it is marked as experimental)
|Installs documentation in QtHelp format.
|-
|-
| QT_PRIVATE_HEADERS
|cmake --install /path/to/build --prefix /path/to/qtc-install --component html_docs
| Set to <span class="caps">QTDIR</span>/include where private headers are installed, if your Qt version doesn’t have them in its standard include directory
|Installs documentation in HTML format.
|}
 
===C Defines===
 
{| class="infotable line"
| <span class="caps">IDE</span>_VERSION_DESCRIPTION
| Text description for the Qt Creator version, shown in parenthesis after the version number in the About dialog. For example used to show “Qt Creator 2.4.82 (2.5.0-beta)” (<span class="caps">IDE</span>_VERSION_DESCRIPTION=“2.5.0-beta” in that case)
|-
|-
| <span class="caps">IDE</span>_REVISION
|cmake --install /path/to/build --prefix /path/to/qtc-devel --component Devel
| String to show as revision in About dialog. Should be set to the git sha that the Qt Creator was built from.
|Installs development package (headers, static libs, .lib files, scripts).
|-
|-
| <span class="caps">IDE</span>_SETTINGSVARIANT
|cmake --install /path/to/build --prefix /path/to/qtc-debug --component DebugInfo
| Changes the directory where Qt Creator looks for user settings and resources. E.g. <code>~/.config/IDE_SETTINGSVARIANT/qtcreator.ini</code> on Linux. Defaults to “Nokia”.
|Installs debug information, if build type is Debug or RelWithDebInfo and QTC_SEPARATE_DEBUG_INFO is ON.
|}
|}


===Install Settings===
==Install Settings==


Qt Creator reads the QtCreator.ini, qtversion.xml and toolchains.xml from its installation directory as “install settings”. (The directory is <code>share/qtcreator/IDE_SETTINGSVARIANT/</code> on Windows and Linux, <code>Qt Creator.app/Contents/Resources/IDE_SETTINGSVARIANT/</code> on Mac.)
Qt Creator reads the QtCreator.ini, qtversion.xml and toolchains.xml from its installation directory as "install settings". (The directory is <tt>share/qtcreator/QtProject/</tt> on Windows and Linux, <tt>Qt Creator.app/Contents/Resources/QtProject/</tt> on Mac.)


The qt versions from the qtversion.xml and tool chains from toolchains.xml are added as “autodetected” to Qt Creator. The settings file (.ini) is used for QSettings::SystemScope. An installer can give any Qt Creator setting a default value by writing into this .ini file.
The qt versions from the qtversion.xml and tool chains from toolchains.xml are added as "autodetected" to Qt Creator. The settings file (.ini) is used for QSettings::SystemScope. An installer can give any Qt Creator setting a default value by writing into this .ini file.


The following special settings (or specially notable settings) are also read by Qt Creator:<br />
The following special settings (or specially notable settings) are also read by Qt Creator:
 
{|
{| class="infotable line"
|ExampleManifests
| ExampleManifests
|Array of strings. Paths to manifest xml files that describe examples to show in Qt Creator's example browser.
| Array of strings. Paths to manifest xml files that describe examples to show in Qt Creator’s example browser.
|-
|Plugins/Ignored
|QStringList (i.e. string containing of comma-separated values). Names of plugins that should not be loaded by default (even though they are installed and not marked experimental).
|-
|-
| Plugins/Ignored
|Plugins/ForceEnabled
| QStringList (i.e. string containing of comma-separated values). Names of plugins that should not be loaded by default (even though they are installed and not marked experimental).
|QStringList (i.e. string containing of comma-separated values). Names of plugins that should be loaded even though they would not be loaded by default (e.g. because they are marked as experimental).
|-
|-
| Plugins/ForceEnabled
|Help/InstalledDocumentation
| QStringList (i.e. string containing of comma-separated values). Names of plugins that should be loaded even though they would not be loaded by default (e.g. because they are marked as experimental).
|QStringList (i.e. string containing of comma-separated values). Paths to qch (documentation) files and directories containing qch files that should be registered with Qt Creator
|-
|-
| Help/InstalledDocumentation
|Settings/InstallSettings
| QStringList (i.e. string containing of comma-separated values). Paths to qch (documentation) files and directories containing qch files that should be registered with Qt Creator
|Path (with '/' path separator) to actual install settings path to use, instead of the default one. Similar to <tt>-settingspath</tt> command line option, but for install settings. Can be a relative path (to application binary). Also exists as command line option <tt>-installsettingspath</tt>
|}
|}
==Todo==
<nowiki>{{DISPLAYTITLE:Building Qt Creator Packages}}</nowiki>
===Categories:===
* [[:Category:Tools|Tools]]
** [[:Category:Tools::QtCreator|QtCreator]]

Latest revision as of 12:38, 17 November 2022


Building Packages

Generally, if you want to build Qt Creator for development purposes, this is described in its README.md. The basics boil down to

cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja "-DCMAKE_PREFIX_PATH=/path/to/Qt;/path/to/llvm" /path/to/qtcreator_sources
cmake --build .

If you want to build packages, we provide a convenience script, that builds Qt Creator, installs the different components (Qt Creator, documentation, debug info, development package), deploys Qt and other dependencies into it, and zips them together.

python /path/to/qtcreator_sources/scripts/build.py --src /path/to/qtcreator_sources --build /tmp/qtc-build --qt-path /path/to/Qt --llvm-path /path/to/llvm

The script has options for some more things like turning of parts, or tweaking the CMake call. The script is used for our official binary packages, the GitHub build and CI. If you want to or need to build packages more directly, see the sections below.

CMake Variables

CMAKE_PREFIX_PATH Used to find all dependencies like Qt, LLVM, elfutils, Python, and yaml-cpp, KSyntaxHighlighting (though we also ship sources for the latter two).
Python3_EXECUTABLE If your CMake finds a Python 2 executable, you need to point it explicitly to Python 3. Used for wizard translations only.
CMAKE_BUILD_TYPE As usual, consider using RelWithDebInfo and setting QTC_SEPARATE_DEBUG_INFO=ON.
QTC_SEPARATE_DEBUG_INFO Set the build type to RelWithDebInfo and this variable to ON, to get a separate target that installs debug information.
BUILD_WITH_PCH Set to ON to enable building Qt Creator with PCH, improving compilation speed if you are not using something like a persistent ccache.
WITH_DOCS Set to ON to add documentation build targets.
BUILD_DEVELOPER_DOCS Set to ON to add developer documentation to documentation build targets. Requires WITH_DOCS=ON.
SHOW_BUILD_DATE Enable the build date in Help > About Qt Creator. Will of course break reproducible builds.
IDE_REVISION Set to ON to add a revision string in Help > About Qt Creator. Also set IDE_REVISION_STR for the actual string. Optionally set IDE_REVISION_URL to make the string clickable, opening the specified URL.
WITH_TESTS Set to ON to build (but not install) tests.
PYTHON_LIBRARY & PYTHON_INCLUDE_DIR For building Python-enabled CDB support on Windows.
BUILD_PLUGIN_... Set to OFF to disable building a specific plugin. Does not do dependency checking.
BUILD_QBS Set to OFF to disable building Qbs together with Qt Creator, even if you checked out the submodule or use a source package that includes it.

CMake Targets

cmake --build /path/to/build Builds Qt Creator
cmake --build /path/to/build --target docs Builds user manual. Also builds developer documentation if BUILD_DEVELOPER_DOCS is ON.
cmake --install /path/to/build --prefix /path/to/qtc-install --strip Installs and strips Qt Creator.
cmake --install /path/to/build --prefix /path/to/qtc-install --component Dependencies Deploys dependencies (Qt, LLVM, elfutils) into the installation directory.
cmake --install /path/to/build --prefix /path/to/qtc-install --component qch_docs Installs documentation in QtHelp format.
cmake --install /path/to/build --prefix /path/to/qtc-install --component html_docs Installs documentation in HTML format.
cmake --install /path/to/build --prefix /path/to/qtc-devel --component Devel Installs development package (headers, static libs, .lib files, scripts).
cmake --install /path/to/build --prefix /path/to/qtc-debug --component DebugInfo Installs debug information, if build type is Debug or RelWithDebInfo and QTC_SEPARATE_DEBUG_INFO is ON.

Install Settings

Qt Creator reads the QtCreator.ini, qtversion.xml and toolchains.xml from its installation directory as "install settings". (The directory is share/qtcreator/QtProject/ on Windows and Linux, Qt Creator.app/Contents/Resources/QtProject/ on Mac.)

The qt versions from the qtversion.xml and tool chains from toolchains.xml are added as "autodetected" to Qt Creator. The settings file (.ini) is used for QSettings::SystemScope. An installer can give any Qt Creator setting a default value by writing into this .ini file.

The following special settings (or specially notable settings) are also read by Qt Creator:

ExampleManifests Array of strings. Paths to manifest xml files that describe examples to show in Qt Creator's example browser.
Plugins/Ignored QStringList (i.e. string containing of comma-separated values). Names of plugins that should not be loaded by default (even though they are installed and not marked experimental).
Plugins/ForceEnabled QStringList (i.e. string containing of comma-separated values). Names of plugins that should be loaded even though they would not be loaded by default (e.g. because they are marked as experimental).
Help/InstalledDocumentation QStringList (i.e. string containing of comma-separated values). Paths to qch (documentation) files and directories containing qch files that should be registered with Qt Creator
Settings/InstallSettings Path (with '/' path separator) to actual install settings path to use, instead of the default one. Similar to -settingspath command line option, but for install settings. Can be a relative path (to application binary). Also exists as command line option -installsettingspath