SDK Tool

Qt Online Installer uses the SDK Tool (sdktool) to configure CMake and set Kit preferences, such as compilers, debuggers, devices, and Qt versions. You can use it from the command line to set Qt and Qt Creator preferences automatically for all users of a computer, for example. For a single user, it is usually easier to make changes in Preferences > Kits.

To use the SDK Tool, enter the following command in the Tools\sdktool\bin directory in the Qt installation directory:

sdktool [OPTION] [OPERATION [OPTIONS]]

For information about the options and operations that your SDK Tool version supports, enter:

sdktool --help

Value Types

The operations add settings in the form <KEY> <TYPE>:<VALUE> to the configuration that they create. The supported TYPE values are:

SDK Path

Qt Online Installer and the Qt Creator stand-alone installer both install sdktool. The sdktool from an installer defaults to the location from where the Qt Creator from the installer reads the information that the SDK Tool writes. To point sdktool to some other Qt Creator installation, set --sdkpath depending on whether you use Qt Online Installer or an offline installer.

  • Qt Online Installer: <Qt_Online_Installer>/Tools/sdktool
  • Qt Creator stand-alone installer:
    • On Windows and Linux: <qtcreator>/share/qtcreator/
    • On macOS Qt Creator.app/Contents/Resources/

Options

The following table summarizes the available options.

OptionDescription
--help | -hDisplay help on SDK tool options.

Enter --help <OPERATION> to get help on the options required for the operation.

--sdkpath=<PATH> | -s <PATH>Set the path to the files that the SDK tool writes.

Operations

The following table summarizes the available operations.

OperationDescription
addAbiFlavorAdd a system architecture (ABI).
addCMakeAdd the path to a CMake tool.
addDebuggerAdd a debugger.
addDevAdd a device.
addKeysAdd settings as <KEY> <TYPE>:<VALUE> key-value pairs.
addKitAdd a build and run kit.
addQtAdd a Qt version.
addTCAdd a compiler.
findFind a setting value.
findKeyFind a setting key.
getGet settings.
rmCMakeRemove the path to a CMake tool.
rmDebuggerRemove a debugger.
rmDevRemove a device
rmKeysRemove settings.
rmQtRemove a Qt version.
rmTCRemove a compiler.

Adding a System Architecture (ABI)

addAbiFlavor

sdktool addAbiFlavor --flavor <NAME> --oses <OS>(,<OS>)*

addAbiFlavor Options

The following table summarizes the available options.

OptionDescriptionRequired
--flavor <NAME>Name of the system architecture (ABI).
--oses <OS>(,<OS>)*Operating system that the ABI applies to.

ABI Flavor Example

To add Yocto Poky on Linux, enter:

./sdktool addAbiFlavor \
--flavor poky \
--oses linux

Adding CMake Tools

addCMake

sdktool addCMake --id <ID> --name <NAME> --path <PATH> [<KEY> <TYPE:VALUE>]

addCMake Options

The following table summarizes the available options.

OptionDescriptionRequired
--id <ID>ID of the CMake installation. Can be any ASCII (7-bit) string.

If you do not use a version number in the string, the registered CMake keeps the ID when you update this CMake installation, and therefore, all kits are automatically updated to use the new version.

--name <NAME>Name of the CMake installation.
--path <PATH>Path to the CMake executable.
<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see Add CMake tools.

CMake Configuration Example

To add a CMake tool on Windows, enter:

sdktool addCMake \
--id "my.custom.cmake" \
--name "Custom CMake" \
--path "C:\Program Files\CMake-3.30\bin\cmake.exe"

Adding Compilers

addTC

sdktool addTC --id <ID> --language <ID> --name <NAME> --path <PATH> --abi <ABI STRING> [OPTIONS]

addTC Options

The following table summarizes the available options.

OptionDescriptionRequired
--abi <ABI STRING>ABI of the compiler in a format that ProjectExplorer::Abi::fromString() can parse.
--id <ID>ID of the toolchain in the format ToolChainType:some_unique_part, where the toolchain type can be one of the following, or something else provided by a plugin:
  • ProjectExplorer.ToolChain.Msvc for Microsoft MSVC compilers. This compiler is automatically detected, so you don't need to add it with the SDK tool.
  • ProjectExplorer.ToolChain.Gcc for GCC on Linux or macOS.
  • ProjectExplorer.ToolChain.Clang for Clang.
  • ProjectExplorer.ToolChain.LinuxIcc for LinuxICC.
  • ProjectExplorer.ToolChain.Mingw for MinGW.
  • ProjectExplorer.ToolChain.ClangCl for Clang/CL.
  • ProjectExplorer.ToolChain.Custom for a custom toolchain.
  • Qt4ProjectManager.ToolChain.Android for Android.
  • Qnx.QccToolChain for QNX QCC.
  • WebAssembly.ToolChain.Emscripten for Emscripten.

Check the classes derived from ProjectExplorer::ToolChain for their IDs.

some_unique_part can be anything. Qt Creator uses GUIDs by default.

--language <ID>ID of the input language of the toolchain: C or Cxx.
--name <NAME>Name of the toolchain.
--path <PATH>Path to the compiler executable.
--supportedAbis <ABI STRING>,<ABI STRING>List of ABIs that the compiler supports.
<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see Add compilers.

Compiler Example

To add a GCC compiler on Linux, enter:

./sdktool addTC \
    --id "ProjectExplorer.ToolChain.Gcc:company.product.toolchain.g++" \
    --language Cxx
    --name "GCC (C++, x86_64)" \
    --path /home/code/build/gcc-6.3/usr/bin/g++ \
    --abi x86-linux-generic-elf-64bit \
    --supportedAbis x86-linux-generic-elf-64bit,x86-linux-generic-elf-32bit \
    ADDITIONAL_INTEGER_PARAMETER int:42 \
    ADDITIONAL_STRING_PARAMETER "QString:some string" \

Adding Debuggers

addDebugger

sdktool addDebugger --id <ID> --name <NAME> [OPTIONS]

addDebugger Options

The following table summarizes the available options.

OptionDescriptionRequired
--abis <ABI,ABI>Comma-separated list of system architecture definitions.
--binary <PATH>Path to the debugger executable. Can be an absolute path, the value auto, or an ABI. Finds the appropriate debugger for MSVC toolchains where Qt Creator does not know the binary path.
--engine <ENGINE>Debugger engine type:
  • 1 for GDB
  • 4 for CDB
  • 8 for PDB
  • 256 for LLDB
  • 512 for GDB DAP
  • 1024 for LLDB DAP
  • 4096 for uVision Debugger
--id <ID>Unique ID of the debugger.
--name <NAME>Name of the debugger.
<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see Add debuggers.

Debugger Example

To add a GDB debugger on Linux, enter:

./sdktool addDebugger \
    --id "company.product.toolchain.gdb" \
    --name "GDB (company, product)" \
    --engine 1 \
    --binary /home/code/build/gdb-7.12/bin/gdb \
    --abis arm-linux-generic-elf-32 \

Adding Devices

addDev

sdktool addDev --id <ID> --name <NAME> --type <INT> [OPTIONS]

addDev Options

The following table summarizes the available options. The options to use depend on the device type.

OptionDescriptionRequired
--authentication <INT>Authentication method:
  • 1 for all authentication methods
  • 2 for SSH authentication using a public and private key pair
--b2qHardware <STRING>Boot to Qt platform info about hardware.
--b2qSoftware <STRING>Boot to Qt platform info about software.
--debugServerKey <STRING>Debug server key.
--dockerClangdExecutable <STRING>Path to the Clangd executable in the Docker container.
--dockerMappedPaths <STRING>Semicolon-separated list of Docker mapped paths.
--dockerRepo <STRING>Docker image repository.
--dockerTag <STRING>Docker image tag.
--freePorts <STRING>Free ports.
--host <STRING>Host name or IP address of the device.
--id <ID>Unique ID of the device.
--keyFile <STRING>Path to the user's private key file.
--name <NAME>Name of the device.
--origin <INT>Whether the device was detected automatically:
  • 1 for a manually added device
  • 2 for an automatically detected device
--osType <STRING>Operating system on the device:
  • Android.Device.Type
  • BareMetalOsType
  • QdbLinuxOsType
  • DockerDeviceType
  • Ios.Device.Type
  • Ios.Simulator.Type
  • McuSupport.DeviceType
  • Desktop
  • WebAssemblyDeviceType
  • QnxOsType
  • GenericLinuxOsType
--password <STRING>Password for password authentication.
--sshPort <INT>Port number for SSH connections.
--timeout <INT>Timeout for reusing the SSH connection in seconds.
--type <INT>Device type:
  • 1 for a hardware device
  • 2 for an emulator, simulator, or virtual device
--uname <STRING>Username to access the device.
<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see How To: Develop for Devices.

Linux Device Example

To add a remote Linux device (hardware device) on Linux and use SSH keys to authenticate to the device, enter:

./sdktool addDev \
    --id " LinuxDevice1" \
    --name "My Remote Linux Device" \
    --type 1 \
    --authentication 2 \
    --freePorts "10000-10100" \
    --host "10.10.10.15" \
    --keyFile "/usr/.ssh/qtc_id" \
    --origin 1 \
    --osType "GenericLinuxOsType" \
    --sshPort 22 \
    --timeout 10 \
    --uname "root"

Adding Qt Versions

addQt

sdktool addQt --id <ID> --name <NAME> --qmake <PATH> --type <TYPE> [OPTIONS]

addQt Options

The following table summarizes the available options.

OptionDescriptionRequired
--abis <ABI,ABI>Comma-separated list of system architecture definitions.
--id <ID>ID of the Qt installation. Qt Creator automatically sets the ID when it detects Qt versions installed on the computer.
--name <NAME>Name of the Qt installation.
--qmake <PATH>Path to the qmake executable in the Qt installation.
--type <TYPE>The type of the Qt version:
  • Qt4ProjectManager.QtVersion.Android for Android.
  • Qt4ProjectManager.QtVersion.Desktop for a desktop Qt.
  • Qt4ProjectManager.QtVersion.Ios for iOS.
  • Qt4ProjectManager.QtVersion.QNX.QNX for QNX.
  • RemoteLinux.EmbeddedLinuxQt for Embedded Linux.
  • Qt4ProjectManager.QtVersion.WebAssembly for WebAssembly.

The string returned by QtVersion::type().

<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see Add Qt versions.

Qt Version Example

To add a self-built Qt 6.8 version on Linux, enter:

./sdktool addQt \
    --id "company.product.qt" \
    --name "Custom Qt" \
    --qmake /home/code/build/qt-6.8/bin/qmake \
    --type Qt4ProjectManager.QtVersion.Desktop \

Adding Kits

addKit

sdktool addKit --id <ID> --name <NAME> --devicetype <TYPE> [OPTIONS]

addKit Options

The following table summarizes the available options.

OptionDescriptionRequired
--builddevice <ID>The ID of the device to build applications on.
--cmake <ID>The ID of the CMake executable to use for building the project.
--cmake-config <KEY:TYPE=VALUE>Parameters for the CMake configuration of the kit. You can add multiple entries of this type.
--cmake-generator <GEN>:<EXTRA>:<TOOLSET>:<PLATFORM>The CMake Generator to use for producing project files.
--debugger <PATH>Path to the debugger to use for the kit. Do not use this option with --debuggerid.
--debuggerengine <ENGINE>The type of the debugger set with --debugger. Do not use this option with --debuggerid.
--debuggerid <ID>One of the IDs used when adding debuggers with the addDebugger operation. Do not use this option with --debugger and --debuggerengine.
--device <ID>The device to run applications on.
--devicetype <TYPE>The type of the device to run applications on:
  • Android.Device.Type for Android devices.
  • Desktop for code running on the local desktop.
  • Ios.Device.Type for iOS devices.
  • Ios.Simulator.Type for iOS simulators.
  • GenericLinuxOsType for embedded Linux devices.
  • WebAssemblyDeviceType for web browsers.

The string returned by IDevice::type().

--env <VALUE>Environment variable values for the build environment. You can add multiple entries of this type.
--icon <PATH>Path to the image to use as an icon for the kit.
--id <ID>ID of the kit. Qt Creator automatically sets the ID when it detects Qt versions installed on the computer.
--<LANG>toolchain <ID>One of the IDs used when adding compilers with the addTC operation. <LANG> is: C, Cxx, Nim, or something set by a plugin.
--mkspec <PATH>The mkspec configuration that qmake uses. Omit this option to use the default mkspec of the set Qt version.
--name <NAME>Name of the kit. You can use variables to generate the kit name based on the kit elements you set with the other operations, such as the Qt version.
--qt <ID>One of the IDs used when adding Qt versions with the addQt operation.
<KEY> <TYPE:VALUE>Additional settings as key-value pairs.

For more information, see Add kits.

Kit Example

To add a kit that uses the GCC compiler and the self-built Qt to build applications on Linux, enter:

./sdktool addKit \
    --id "company.product.kit" \
    --name "Qt %{Qt:Version} (company, product)" \
    --debuggerid "company.product.toolchain.gdb" \
    --devicetype GenericLinuxOsType \
    --sysroot /tmp/sysroot \
    --Ctoolchain "ProjectExplorer.ToolChain.Gcc:company.product.toolchain.gcc" \
    --Cxxtoolchain "ProjectExplorer.ToolChain.Gcc:company.product.toolchain.g++" \
    --qt "company.product.qt" \
    --mkspec "devices/linux-mipsel-broadcom-97425-g++" \

Adding, Getting, and Finding Keys

Enter the path to a file relative to the top-level settings directory and without .xml extension, followed by one or more <KEY> <TYPE>:<VALUE> key-value pairs.

Removing Configured Items

To remove a CMake tool, compiler, debugger, device, Qt version, or kit, enter:

rm<Item> --id <ID>

Where <ID> is the ID of the item.

See also How To: Manage Kits, Installation, and Kits.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.