Distributing Extensions and Plugins | Extending Qt Creator Manual

- Extending Qt Creator Manual
- Distributing Extensions and Plugins
- Extending Qt Creator Manual 18.0.2

# Distributing Extensions and Plugins

To make your extension or plugin available to a wider range of users, publish it as a Qt Creator extension or plugin that users can discover and install in the Extensions mode.

You can also distribute archives of Lua extensions or binary builds of C++-based plugins that users can install in Edit > Preferences > Extensions > Install Extensions.

## Publishing Extensions

The default distribution channel for extensions is the Qt Creator extension registry.

Before publishing an extension, read the Qt Extension Publisher Agreement.

To publish an extension, follow the instructions in the registry repository.

Users can add their own extension registries, as described in Qt Creator: Install extensions.

## Creating Binaries of C++-Based Plugins

If your C++-based plugin runs and works on multiple platforms, you should provide binary builds for all of the supported platforms.

Qt Creator currently supports:

- Windows
- Linux
- macOS

See the toplevel README.md file in Qt Creator's sources for a more detailed list.

The Qt Creator Plugin wizard already creates a template for GitHub Actions which can be used to create binaries if you host your plugin sources on GitHub. See the README.md that is created at the same location for details.

You can also use the provided GitHub Actions recipe as inspiration for another build service of your choice.

## Packaging

The easiest way to package your plugin is to simply provide a zip file that the user can unpack to the correct location for Qt Creator to find it. Qt Creator makes that easy for the user by providing an Install Plugin button in the Help > About Plugins dialog (or Qt Creator > About Plugins on macOS). The user chooses a zip file with the plugin, and Qt Creator unpacks that to the appropriate location.

The following sections describe the options you have for the plugin's contents layout.

### Single Library

Using a single library is the preferred and simplest option. You provide a single plugin library file that has all required resources compiled into it with The Qt Resource System. This imposes some limitations because you cannot depend on additional binaries, nor extend some parts of Qt Creator that rely on external files, like the generic highlighter. You can still add wizard templates this way, by adding the path to the resource directory into your QRC file with ProjectExplorer::JsonWizardFactory::addWizardPath(). Registering documentation and translations can be done in similar ways.

#### Summary

- Single library as single item in a zip file.
- Resources compiled into the library with The Qt Resource System.
- Can be installed locally for a single user for all compatible Qt Creator installations.
- Can be installed into a Qt Creator installation for all users.

### Multiple Files Following Qt Creator's Filesystem Layout

This is a more flexible solution with regards to what the plugin can do, but more complicated to set up. This allows the plugin to ship additional binaries and arbitrary resources.

Since the filesystem layout varies heavily between platforms, the build system of Qt Creator provides variables like `IDE_DATA_PATH` and `IDE_LIBEXEC_PATH`. If you build your plugin with CMake, you should use the provided `add_qtc_library`, `add_qtc_executable` and similar functions as well.

At runtime you can access these platform dependent locations with Core::ICore::resourcePath() and Core::ICore::libexecPath().

Plugins that are distributed this way cannot be installed locally for a single user. They must be installed into the Qt Creator installation directly.

#### Summary

- Multiple files following standard filesystem layout.
- Use Qt Creator specific variables and functions in build system.
- Use Core::ICore to find the locations at runtime.
- Can only be installed into a Qt Creator installation for all users.