Cqtdeployer linux как использовать

Обновлено: 01.07.2024

Support the project

If you like what we do and it benefits you, you can support the project on the official page QuasarApp on Patreon

What is CQtDeployer

CQtDeployer helps you to extract all libraries your executable depends on and to create a launch script for your application.

Key differences of this program:

  • Performance: this program deploys the application several times faster (up to 10 seconds)
  • Flexibility: this application has flags that help you to configure the deployment for your or your project's needs
  • Cross-deployment: this application supports Windows and Linux distributions. This means that you can deploy a project not only for the host platform, but also deploy a project for Windows target on Linux host and vice versa.
  • Fast installers creation: Once the deployment is complete, you will receive a standalone installer for your distribution.

Supported processors architectures:

Example: cqtdeployer <-bin [params]> [options]

See the list of all options here

Example: cqtdeployer -bin myApp -qmlDir


Project installer after deployment with the qif option.


Project installer after deployment with the qif and qifStyle options.



Build and install

See building and installation instructions on wiki page

Projects using CQtDeployer:

    - Qt cross-platform serial port socket assistant for visualizing data. - Simple encryption library supporting RSA and AES algorithms. - Hanoi Towers Game - Distribution Builder - Qt Quick Controls 2 - Linux Manager Desktop Application - IDE 65XX is one of the open source IDE options available for developers working with Kick Assembler. - 2D game written in C++ & Qt for Windows, Linux and Android - Bit-level Image Manipulation Software with Qt Framework - Steganography Pet Project - This is a board that you can share with others.

Check out our documentation for more information: here

Credits

Join the development fund and support QuasarApp to help us develop of our projects.

If you would like to use bitcoins to support us, you can transfer coins to this address. If you want to be included in the Patrons list, e-mail me at QuasarApp@yandex.by.

Note: Your message should be signed with the address of the Bitcoin wallet which was used to make the payment.

CQtDeployer cross-platform deployment utility C++ Qt or QML applications.

Using 'cqtdeployer' can greatly simplify the deployment of C++ Qt or QML projects.

Contents

Important

This utility is not an official development of qt and is supported by the community.

The main differences of this program:

  • Performance: this program deploys the application several times faster (up to 10 seconds)
  • Flexibility: this application's got flags that help you to configure the deployment for your or your project's needs
  • Crossdeploy: this application's support windows and linux distrebutives, This means that you can use it not only to deploy a project for your platform, but also to deploy a project on Linux for Windows and vice versa.

How CQtDeployer works

The utility transfers the path to the executable files of the deployed programs using the option -bin. The transferred programs are analyzed and get a list of dependencies. If the programs being deployed depend on Qt, then a list of modules is formed based on the dependencies. Qt plugins are deployed depending on the qt modules used. Then qml plugins are copied, if necessary, and standard qt translations. After completing all the steps described, scripts are formed to launch the application.

Example usage

  • cqtdeployer is a utility call (befor version 1.4 windows version used %cqtdeployer% command).
  • - bin - the option for transferring the paths of the application executable files.
  • myApp.exe and myApp - the path to the application executable file itself
  • - qmake - the option for transferring qmake paths for qt deployment.
  • - qmlDir - the option for transferring paths to qml files of the application.

Supported Qt versions

CQtDeployer supports Qt4, Qt5 and Qt6 deployments (since version 1.4.7).

Snap version

CQtDeployer for Linux platforms is distributed in 2 formats:

The version for Snap works in an isolated container, because of this the utility does not have access to system files and libraries (/lib/, /usr/lib/).

To allow access to system libraries, enable all permissions for cqtdeployer. This can be done in the snap-store Or starting with ubuntu 20.04 in the ubuntu application settings manager.

If you do not have the GUI then you can enable all permissions using next commands:

CQtDeployer (произносится «си-къют-деплоер») — кроссплатформенная утилита развертывания C++ Qt или QML приложений.

Использование cqtdeployer может значительно упростить развертывание C++ Qt или QML проектов.

Contents

Важно

Данная утилита не является официальной разработкой qt и поддерживается силами сообщества.

Основные отличия этой программы:

  • Производительность - эта программа развертывает приложение до 10 секунд.
  • Гибкость - это приложение имеет флаги, которые помогут вам настроить деплоинг под ваши нужды и нужды вашего проекта
  • Crossdeploy: приложение поддерживает Windows и дистрибутивы Linux, это означает, что вы можете использовать его не только для развертывания проекта для вашей платформы, но и для развертывания проекта в Linux для Windows и наоборот.

Принцип работы CQtDeployer

Утилите передаются пути к исполняемым файлам разворачиваемых программ при помощи флага -bin. Переданные программы анализируются и рекурсивно извлекается список зависимостей. Если развертываемые программы зависит от Qt, то исходя из зависимостей формируется список модулей. В зависимости от используемых модулей qt, развертываются плагины qt. Затем копируются qml плагины если такие требуются и стандартные переводы qt. После выполнения всех описанных шагов формируются скрипты для запуска приложения.

Пример использования

  • cqtdeployer - это вызов утилиты. (до версии 1.4 в Windows использовалась команда %cqtdeployer%)
  • -bin - флаг для передачи путей исполняемых файлов приложения.
  • myApp.exe и myApp - сам путь к исполняемому файлу приложения
  • -qmake - флаг для передачи путей к qmake для развертывания qt.
  • -qmlDir - флаг для передачи путей к qml файлам приложения.

Поддерживаемые версии Qt

CQtDeployer поддерживает развертывания 'Qt4' , 'Qt5' и 'Qt6' (начиная с версии 1.4.7).

Snap версия

CQtDeployer для Linux платформ распространяется в 2х видах:

Версия для Snap работает в изолированном контейнере, из-за этого утилита не имеет доступа к системным файлам и библиотекам (/lib/, /usr/lib/).


Чтобы разрешить доступ к системным библиотекам, включите все разрешения для cqtdeployer. Это можно сделать в snap-store Или начиная с ubuntu 20.04 в менеджере настроек приложений ubuntu.

Если у вас нет графического интерфейса, вы можете включить все разрешения, используя следующие команды:

Как развернуть приложение

В этой статье я описываю процессы развертывания приложения c++/qt с помощью cqtdeployer.

Если вам нужна максимальная стабильность вашего дистрибутива и вы хотите запускать свое приложение в разных дистрибутивах с разными версиями, вам необходимо использовать Qt из официального build.

В этом случае мы развертываем приложение Qt GUI для Ubuntu 16.04, Ubuntu 18.04 и Ubuntu 20.04++.

Если вы хотите поддерживать все дистрибутивы, начиная с Ubuntu 16.04, вам необходимо собрать и развернуть приложение в более старом дистрибутиве (в моем случае это 16.04)

Если вы хотите использовать системный qt из своей ОС, установите классическую версию cqtdeployer.

Настройка CQtDeployer

Выберите последнюю стабильную версию (1.4)

Если вы используете официальную сборку qt, вы можете использовать snap-версию cqtdeployer.

После установки добавьте необходимые разрешения.

Развертывание приложения Qt GUI

Разверните исполняемый файл.

  • Для кроссплатформенной сборки (Linux -> Windows)

Если вы используете дополнительные библиотеки, просто добавьте путь для cqtdeployer к используемым библиотекам.

Если вы хотите найти библиотеки рекурсивно из пути libDir, просто добавьте параметр рекурсивной глубины.

Если ваше приложение использует qml, просто добавьте опцию qmlDir

Если вы хотите создать простой установщик для своего приложения, просто добавьте опцию gif.

Если cqtdeployer не нашел qmake, добавьте параметр -qmake в команду вызова.

На живом примере animation из Примеров Qt

Собираем проект в релизную сборку

Выполняем qmake с опцие -r для релизной сборки.

Вызываем ваш make generator

Находим наш получившийся исполняемый файл

Если вы собирали проект с помощью qtCreator ваш исполняемый файл будет находиться на уровень выше в папке build-Animations-Desktop_Qt_5_15_2_GCC_64bit-Release В моем случае исполняемый файл лежит в корневом катологе проекта.

Вызываем cqtdeployer для формирования Базового Дистрибутива

Готово. дистрибутив был сохранен в папку DistributionKit

Снимок экрана от 2021-02-22 11-25-34

После установки буду созданы все необходимые ярлыки.

Снимок экрана от 2021-02-22 11-29-23

Интеграция с QtCreator

К сожалению, на данный момент нет интеграции с qtcreator. Единственный способ - включить цель сборки для qmake или cmake

Параметр libDir используется для установки путей к каталогам, в которых пути содержат зависимости вашего приложения, а параметр qmlDir используется для установки путей к каталогам, содержащих файлы qml, необходимые вашему приложению. В этом примере корень исходного кода приложения выбирается этими двумя параметрами.

Параметр recursiveDepth используется для установки глубины поиска libDir и qmlDir.

Параметр qif используется для создания установщика с использованием Qt Installer Framework.

Создаем тестовый проект

Снимок экрана от 2021-02-22 12-15-51

Открываем панель управления проектом

На выходе вы получите папку DistributionKit с установщиком вашего приложения.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Читайте также: