Building-Qt-Creator-Packages: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add information about Settings/InstallSettings key)
 
(6 intermediate revisions by 3 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>
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja "-DCMAKE_PREFIX_PATH=/path/to/Qt;/path/to/llvm" /path/to/qtcreator_sources
where <tt>$GIT_COMMIT</tt> should be the sha1 of the commit that you build, and where the <tt>QTC_PREFIX</tt> is the directory prefix used for the 7zips that are created by the bindist target (see below).
cmake --build .
# set the following environment variables:
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.
## <tt>INSTALL_ROOT</tt>: changes the location for the install dir when doing <tt>make install</tt>, e.g. <tt>$BUILDDIR/install/qtcreator</tt> (not used on Mac)
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
## <tt>INSTALL_EDITION</tt>: can be set to e.g. <tt>-opensource</tt>, used for 7z and dmg file names, <tt>$${PLATFORM}$(INSTALL_EDITION)-$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)</tt>
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.
## <tt>INSTALL_POSTFIX</tt>: used for 7z and dmg file names, <tt>$${PLATFORM}$(INSTALL_EDITION)-$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)</tt>
# <tt>make</tt>
# <tt>make docs</tt>
# <tt>make install</tt> (don't use on Mac)
# <tt>make install_docs</tt> (don't use on Mac)
# <tt>make deployqt</tt>


After these calls the <tt>INSTALL_ROOT</tt> (Windows/Linux) or <tt>$BUILDDIR/bin/Qt Creator.app</tt> (Mac) contains a distributable binary build.
== CMake Variables ==
 
{| class="wikitable"
To add "external" executables (jom, qtcreatorcdbext64) that we deploy for Windows builds to your install, call <tt>make deployartifacts</tt>
|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 <tt>make bindist</tt>
|-
 
|Python3_EXECUTABLE
That packages the files with a directory starting with the <tt>QTC_PREFIX</tt> 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 <tt>make bindist_installer</tt>
|CMAKE_BUILD_TYPE
 
|As usual, consider using RelWithDebInfo and setting QTC_SEPARATE_DEBUG_INFO=ON.
To create a disk image (dmg) with the <tt>Qt Creator.app</tt> on Mac, call <tt>make dmg</tt>
|-
 
|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 <tt>make install</tt>, e.g. <tt>$BUILDDIR/install/qtcreator</tt> (not used on Mac), installation is done into <tt>$(INSTALL_ROOT)$$QTC_PREFIX</tt>
|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 <tt>qt-creator-$${PLATFORM}$(INSTALL_EDITION)-$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)</tt>
|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. <tt>-opensource</tt>, 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 <tt>make installer</tt> 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 <tt>make install</tt> and for what is packaged with <tt>make bindist</tt>, must start with a <tt>/</tt>, e.g. <tt>/qt-creator-x.y.z</tt>, installation is done into <tt>$(INSTALL_ROOT)$$QTC_PREFIX</tt>
|-
|cmake --build /path/to/build --target docs
|Builds user manual. Also builds developer documentation if BUILD_DEVELOPER_DOCS is ON.
|-
|-
|IDE_PACKAGE_MODE
|cmake --install /path/to/build --prefix /path/to/qtc-install --strip
|Disables building the HellWorld and UpdateInfo plugins (which are built but marked experimental otherwise)
|Installs and strips Qt Creator.
|-
|-
|UPDATEINFO_ENABLE
|cmake --install /path/to/build --prefix /path/to/qtc-install --component Dependencies
|Enables the UpdateInfo plugin and enables it for the build (usually it is marked as experimental)
|Deploys dependencies (Qt, LLVM, elfutils) into the installation directory.
|-
|-
|QT_PRIVATE_HEADERS
|cmake --install /path/to/build --prefix /path/to/qtc-install --component qch_docs
|Set to QTDIR/include where private headers are installed, if your Qt version doesn't have them in its standard include directory
|Installs documentation in QtHelp format.
|-
|-
|QTC_SKIP_CDBEXT
|cmake --install /path/to/build --prefix /path/to/qtc-install --component html_docs
|Disables building the cdb extension. Only has an affect on windows.
|Installs documentation in HTML format.
|}
 
=== C Defines ===
 
{|
|IDE_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)" (IDE_VERSION_DESCRIPTION="2.5.0-beta" in that case)
|-
|-
|IDE_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).
|-
|-
|IDE_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. <tt>~/.config/IDE_SETTINGSVARIANT/qtcreator.ini</tt> on Linux. Defaults to "QtProject".
|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 <tt>share/qtcreator/IDE_SETTINGSVARIANT/</tt> on Windows and Linux, <tt>Qt Creator.app/Contents/Resources/IDE_SETTINGSVARIANT/</tt> 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.
Line 92: Line 87:
The following special settings (or specially notable settings) are also read by Qt Creator:
The following special settings (or specially notable settings) are also read by Qt Creator:
{|
{|
| 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  
|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).
|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  
|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).
|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  
|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
|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
|Settings/InstallSettings
| 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).
|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>
|}
|}

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