Using the QT installer framework to make the installation package (not sure if it is suitable for Mac and Linux?) )

Source: Internet
Author: User

First, Introduction

Applications developed using the QT Library are typically published in two ways: (1) static compilation of the publication. This way, the program compiles the QT core library into an executable file at compile time. Its advantages are simple and single, all the dependent libraries are concentrated together, its shortcomings are also obvious, the volume of the executable program is large, the optical QT Core library plus up to more than 10 trillion. (2) Make the installation package release. The principle of this approach is also simple, that is, the executable program and its dependent library files are packaged and compressed, made into the installation package release. There are a lot of tools to make the installation package, and today it's about Qt's official installation package, the QT installerFramework. This framework is produced by QT official, widely used in Qt library, Qt creator and other installation package products. Search the Internet, the relevant tutorials seem to be few.

Second, the use of configuration

After you have downloaded and installed the QT installer framework, you need to create a destination folder. All files that need to be packaged are placed under this folder. The contents of my folder are as follows:

Then we need to install the following directory organization structure to create folders, note that it is important to install such a sequential organization folder OH. The simplest way to do this is to copy one from the examples inside the QT Installer framework installation directory, and modify it on this basis:

The root folder I created is SC. Two sub-folders are created under SC: Config and packages. Create a config. xml file under the Config folder that is used to customize the UI and behavior of the installation package in the following basic format:

123456789101112131415161718192021222324252627 <?xmlversion="1.0"?><Installer>    <Name>Some Application</Name>    <Version>1.0.0</Version>    <Title>Some Application Setup</Title>    <Publisher>Your Company</Publisher>    <ProductUrl>http://www.your-fantastic-company.com</ProductUrl>    <InstallerWindowIcon>installericon</InstallerWindowIcon>    <InstallerApplicationIcon>installericon</InstallerApplicationIcon>    <Logo>logo.png</Logo>    <Watermark>watermark.png</Watermark>    <RunProgram></RunProgram>    <RunProgramArguments></RunProgramArguments>    <RunProgramDescription></RunProgramDescription>    <StartMenuDir>Some Application Entry Dir</StartMenuDir>    <UninstallerName>SDKMaintenanceTool</UninstallerName>    <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>    <Background>background.png</Background>    <TargetDir>@[email protected]/testinstall</TargetDir>    <AdminTargetDir>@[email protected]/testinstall</AdminTargetDir>    <RemoteRepositories>        <Repository>            <Url>http://www.your-repo-location/packages/</Url>        </Repository>    </RemoteRepositories></Installer>

Where the name and version child elements are required, the other child elements are optional, and the order can be arbitrary. The meanings of these configuration items can be viewed on the links on the official website.

As we can see in the above figure, we create a folder named Org.hust.simulator. In fact, the Qt Installer framework introduces the concept of components. That is, each individual module can be placed in a single component component, for large programs such a clear structure is conducive to engineering organization, reduce complexity. In the example, it is simpler to use only one component, and you can create multiple components as needed:

12345678910111213 packages    -com.vendor.root        -data        -meta    -com.vendor.root.component1        -data        -meta    -com.vendor.root.component1.subcomponent1        -data        -meta    -com.vendor.root.component2        -data        -meta

It can be noted that each component in the Packages folder needs to create two subfolders meta and data. The meta directory is used to store some configuration files that specify the installation and deployment process. You need at least one package.xml in the Meta folder and all the resource files referenced in the file, such as script files, interface resources, translation files, and so on. The package.xml file describes the basic information for a component in the following format:

12345678910111213141516171819202122232425262728293031 <?xmlversion="1.0"?><Package>    <DisplayName>QtGui</DisplayName>    <Description>Qt gui libraries</Description>    <Descriptionxml:lang="de_de">Qt GUI Bibliotheken</Description>    <Version>1.2.3</Version>    <ReleaseDate>2009-04-23</ReleaseDate>    <Name>com.vendor.root.component2</Name>    <Dependencies>com.vendor.root.component1</Dependencies>    <Virtual>false</Virtual>    <Licenses>        <License name="License Agreement" file="license.txt" />    </Licenses>    <Script>installscript.qs</Script>    <UserInterfaces>        <UserInterface>specialpage.ui</UserInterface>        <UserInterface>errorpage.ui</UserInterface>    </UserInterfaces>    <Translations>        <Translation>sv_se.qm</Translation>        <Translation>de_de.qm</Translation>    </Translations>    <DownloadableArchives>component2.7z, component2a.7z</DownloadableArchives>    <AutoDependOn>com.vendor.root.component3</AutoDependOn>    <SortingPriority>123</SortingPriority>    <UpdateText>This changed compared to the last release</UpdateText>    <Default>false</Default>    <ForcedInstallation>false</ForcedInstallation>    <Essential>false</Essential>    <Replaces>com.vendor.root.component2old</Replaces></Package>

Where the agreement terms are specified in the License section, the file attribute specifies the files in which the terms of the agreement are located. The Userinterfaces and Translations sections specify interface resource files and translation files respectively. The scripts section specifies the script file, in which the installation process can be customized in more detail. The other element names and values in the sample are easier to understand and not difficult to modify. All options can be viewed by the officer Web.

The data folder is used to store the program files (*.dll, *.exe, etc.) that we actually need to package, and the Qt installer framework uses Archivegen to compress these files into 7zip format during the production process. The data files are automatically extracted from the compressed package during the installation process. Finally my file is organized as follows:

For convenience, I dragged this SC folder directly to the QT Installer framework installation directory, so that you can use the Binarycreator.exe tool directly under the command line. When the preparation is complete, start building the installation package:

1 binarycreator.exe -c sc\config\config.xml -p sc\packages my_installer.exe -v

The command runs complete and the My_installer.exe file is generated in the directory where the Binarycreator.exe is located. Run up to see:

Third, summary

The whole configuration process from above is quite simple, and the Official handbook is also very complete. I have to lament that the document is sound is good. I used to use other tools to make the installation package, this time I tried the QT installer framework to make the installation package is satisfactory.

Reference
    • Http://doc.qt.io/qtinstallerframework/ifw-tutorial.html
    • Http://www.cnblogs.com/dyllove98/archive/2013/06/17/3141316.html
    • http://www.qt.io/download-open-source/#

Http://www.cnblogs.com/csuftzzk/p/qt-installer-framework.html

Using the QT installer framework to make the installation package (not sure if it is suitable for Mac and Linux?) )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.