Building-Qt-Creator-Packages

From Qt Wiki
Revision as of 12:38, 17 November 2022 by Ziller (talk | contribs) (→‎Install Settings)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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