Building-Qt-Creator-Packages: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Tools::QtCreator]]
[[Category:Tools::QtCreator]]


== General Building of Qt Creator ==
==Building Packages==


# It is recommended to build in a shadow build directory
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
# <code>qmake $SOURCES/qtcreator.pro CONFIG+=release" "DEFINES+=IDE_REVISION=$GIT_COMMIT" "QTC_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>QTC_PREFIX</code> is the directory prefix used for the 7zips that are created by the bindist target (see below).
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja "-DCMAKE_PREFIX_PATH=/path/to/Qt;/path/to/llvm" /path/to/qtcreator_sources
# set the following environment variables:
cmake --build .
## <code>INSTALL_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)
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.
## &lt;code&amp;gt;INSTALL_EDITION&amp;lt;/code&amp;gt;: can be set to e.g. &lt;code&amp;gt;&amp;#45;opensource&amp;lt;/code&amp;gt;, used for 7z and dmg file names, &lt;code&amp;gt;$${PLATFORM}$(INSTALL_EDITION)<s>$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)&lt;/code&amp;gt;<br />## &lt;code&amp;gt;INSTALL_POSTFIX&amp;lt;/code&amp;gt;: used for 7z and dmg file names, &lt;code&amp;gt;$${PLATFORM}$(INSTALL_EDITION)</s>$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)&lt;/code&amp;gt;
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
# &lt;code&amp;gt;make&amp;lt;/code&amp;gt;
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.
# &lt;code&amp;gt;make docs&amp;lt;/code&amp;gt;
# &lt;code&amp;gt;make install&amp;lt;/code&amp;gt; (don't use on Mac)
# &lt;code&amp;gt;make install_docs&amp;lt;/code&amp;gt; (don't use on Mac)
# &lt;code&amp;gt;make deployqt&amp;lt;/code&amp;gt;


After these calls the &lt;code&amp;gt;INSTALL_ROOT&amp;lt;/code&amp;gt; (Windows/Linux) or &lt;code&amp;gt;$BUILDDIR/bin/Qt Creator.app&amp;lt;/code&amp;gt; (Mac) contains a distributable binary build.
== CMake Variables ==
 
{| class="wikitable"
To add &quot;external&amp;quot; executables (jom, qtcreatorcdbext64) that we deploy for Windows builds to your install, call<br /># &lt;code&amp;gt;make deployartifacts&amp;lt;/code&amp;gt;
|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<br /># &lt;code&amp;gt;make bindist&amp;lt;/code&amp;gt;<br />That packages the files with a directory starting with the &lt;code&amp;gt;QTC_PREFIX&amp;lt;/code&amp;gt; you set in the qmake call.
|-
 
|Python3_EXECUTABLE
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<br /># &lt;code&amp;gt;make bindist_installer&amp;lt;/code&amp;gt;
|If your CMake finds a Python 2 executable, you need to point it explicitly to Python 3. Used for wizard translations only.
 
|-
To create actual Qt Creator-only installers, you need to have the installer framework binaries installed, then<br /># set the following additional environment variable:<br />## &lt;code&amp;gt;IFW_PATH&amp;lt;/code&amp;gt;: location where &lt;code&amp;gt;make installer&amp;lt;/code&amp;gt; looks for the installer framework binaries (i.e. its bin/ and lib/ directories)<br /># &lt;code&amp;gt;make bindist_installer installer&amp;lt;/code&amp;gt;
|CMAKE_BUILD_TYPE
 
|As usual, consider using RelWithDebInfo and setting QTC_SEPARATE_DEBUG_INFO=ON.
To create a disk image (dmg) with the &lt;code&amp;gt;Qt Creator.app&amp;lt;/code&amp;gt; on Mac, call<br /># &lt;code&amp;gt;make dmg&amp;lt;/code&amp;gt;
|-
 
|QTC_SEPARATE_DEBUG_INFO
== Things affecting the build/install ==
|Set the build type to RelWithDebInfo and this variable to ON, to get a separate target that installs debug information.
 
|-
=== Environment Variables ===
|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.
{|
|-
|INSTALL_ROOT
|WITH_DOCS
|Changes the location for the install dir when doing &lt;code&amp;gt;make install&amp;lt;/code&amp;gt;, e.g. &lt;code&amp;gt;$BUILDDIR/install/qtcreator&amp;lt;/code&amp;gt; (not used on Mac), installation is done into &lt;code&amp;gt;$(INSTALL_ROOT)$$QTC_PREFIX&amp;lt;/code&amp;gt;
|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.
|-
|-
|INSTALL_BASENAME
|IDE_REVISION
|Sets the base name used for the files created by make bindist, bindist_installer, dmg and dmg_installer. Defaults to &lt;code&amp;gt;qt-creator-$${PLATFORM}$(INSTALL_EDITION)-$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)&lt;/code&amp;gt;
|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.
|-
|-
|INSTALL_EDITION
|WITH_TESTS
|Can be set to e.g. &lt;code&amp;gt;&amp;#45;opensource&amp;lt;/code&amp;gt;, used for default INSTALL_BASENAME
|Set to ON to build (but not install) tests.
|-
|-
|INSTALL_POSTFIX
|PYTHON_LIBRARY & PYTHON_INCLUDE_DIR
|Used for default INSTALL_BASENAME
|For building Python-enabled CDB support on Windows.
|-
|-
|IFW_PATH
|BUILD_PLUGIN_...
|Location where &lt;code&amp;gt;make installer&amp;lt;/code&amp;gt; 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.
|-
|-
|INSTALLER_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"
{|
|cmake --build /path/to/build
|QTC_PREFIX
|Builds Qt Creator
|directory prefix for the install directory &lt;code&amp;gt;make install&amp;lt;/code&amp;gt; and for what is packaged with &lt;code&amp;gt;make bindist&amp;lt;/code&amp;gt;, must start with a &lt;code&amp;gt;/&amp;lt;/code&amp;gt;, e.g. &lt;code&amp;gt;/qt-creator-x.y.z&amp;lt;/code&amp;gt;, installation is done into &lt;code&amp;gt;$(INSTALL_ROOT)$$QTC_PREFIX&amp;lt;/code&amp;gt;
|-
|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.
|-
|-
|IDE_PACKAGE_MODE
|cmake --install /path/to/build --prefix /path/to/qtc-install --component html_docs
|Disables building the HellWorld and UpdateInfo plugins (which are built but marked experimental otherwise)
|Installs documentation in HTML format.
|-
|-
|UPDATEINFO_ENABLE
|cmake --install /path/to/build --prefix /path/to/qtc-devel --component Devel
|Enables the UpdateInfo plugin and enables it for the build (usually it is marked as experimental)
|Installs development package (headers, static libs, .lib files, scripts).
|-
|-
|QT_PRIVATE_HEADERS
|cmake --install /path/to/build --prefix /path/to/qtc-debug --component DebugInfo
|Set to QTDIR/include where private headers are installed, if your Qt version doesn't have them in its standard include directory
|Installs debug information, if build type is Debug or RelWithDebInfo and QTC_SEPARATE_DEBUG_INFO is ON.
|}
|}


=== C Defines ===
==Install Settings==
 
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 following special settings (or specially notable settings) are also read by Qt Creator:
{|
{|
|IDE_VERSION_DESCRIPTION
|ExampleManifests
|Text description for the Qt Creator version, shown in parenthesis after the version number in the About dialog. For example used to show &quot;Qt Creator 2.4.82 (2.5.0-beta)&quot; (IDE_VERSION_DESCRIPTION=&quot;2.5.0-beta&amp;quot; in that case)
|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).
|-
|-
|IDE_REVISION
|Help/InstalledDocumentation
|String to show as revision in About dialog. Should be set to the git sha that the Qt Creator was built from.
|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
|-
|-
|IDE_SETTINGSVARIANT
|Settings/InstallSettings
|Changes the directory where Qt Creator looks for user settings and resources. E.g. &lt;code&amp;gt;~/.config/IDE_SETTINGSVARIANT/qtcreator.ini&amp;lt;/code&amp;gt; on Linux. Defaults to &quot;Nokia&amp;quot;.
|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>
|}
|}
=== Install Settings ===
Qt Creator reads the QtCreator.ini, qtversion.xml and toolchains.xml from its installation directory as &quot;install settings&amp;quot;. (The directory is &lt;code&amp;gt;share/qtcreator/IDE_SETTINGSVARIANT/&amp;lt;/code&amp;gt; on Windows and Linux, &lt;code&amp;gt;Qt Creator.app/Contents/Resources/IDE_SETTINGSVARIANT/&amp;lt;/code&amp;gt; on Mac.)
The qt versions from the qtversion.xml and tool chains from toolchains.xml are added as &quot;autodetected&amp;quot; to Qt Creator. The settings file &amp;#40;.ini&amp;amp;#41; 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 />| ExampleManifests | Array of strings. Paths to manifest xml files that describe examples to show in Qt Creator's example browser.|<br />| 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).|<br />| 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).|<br />| 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|
== Todo ==

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