Qt Lite and configuration changes in Qt 5.8

2020-02-05 03:39发布

So allegedly, the configuration tool for Qt went through some changes, necessary to be able to make more streamlined Qt builds, a.k.a "Qt Lite". However, there doesn't seem to be any documentation about how to use that feature, or at least I don't find any, and looking at the comments from the release announcement, others can't neither.

What's more, the changes are definitely in there, judging by the fact that the configuration that I've been using for the last couple of years fails in a bunch of ways. I am not sure how up-to-date the built in help is, since the last time I tried using it for guidance, it turned out it was largely outdated and contained options that were no longer supported.

So it would be nice if someone could shed some light on what has changed and how, and how to configure for "Lite" builds. And especially on module and feature dependencies, because I think we'd all like to avoid wasting time on builds that will start building despite an improper configuration that omits necessary dependencies just to have it inevitably fail and result in nothing but a waste of time.

3条回答
Emotional °昔
2楼-- · 2020-02-05 03:46

Per to the changelog:

  • The configuration system has been rewritten almost from scratch. This improved the consistency between builds on Unix and Windows, but some subtle unintended behavior changes are also possible. Also, some obsolete options have been entirely removed and will now cause errors.
  • It is not permissible any more to manually #define QT_NO_ anywhere. Instead, configure's -no-feature-* options must be used. Note that this does not apply to defines which modify behavior rather than entirely removing features.
  • The -no-feature-* option family was integrated with the rest of the configuration system. Numerous existing features were made optional, and build problems in various reduced configurations were fixed. This is an ongoing effort known as "Qt Lite".

Features for -no-feature-* lists are in qtbase\src\corelib\global\qfeatures.txt.

All features are enabled by default.

More information can be found in the Qt Lite Overview Presentation and its slides.

You can also use the new UI Tool which is known as Qt Configuration Tool and which is a part of Qt for Embedded Devices package - see its documentation. The configuration tool is available for commercial Qt customers only at the moment (Qt 5.8).

查看更多
我只想做你的唯一
3楼-- · 2020-02-05 04:01

Everything that describes what the new configuration system understands is given in the configure.json files scattered around Qt modules. The configure tool uses these files to build a list of command line arguments it understands.

Without the use of other tools, to learn about Qt features you need to inspect these json files and choose the features/options you wish turned on or off.

Sub Configurations

These act as includes, and refer to the configure.json file in a given folder. E.g. qtbase/configure.json includes qtbase/src/corelib/configure.json, qtbase/src/network/configure.json etc.:

"subconfigs": [
    "src/corelib",
    "src/network",
    [...]
],

Explicit Command Line Options

The commandline/options value lists the configure options a given Qt module understands. These options are separate from the feature system, although they may be used for convenience to provide shorthand aliases that control features. For example, in qtbase/configure.json, we have:

{ "commandline": { "options": { "accessibility": "boolean", [...] }

This command line option controls the identically named accessibility feature. It is more convenient to use than dealing with the feature system's option [-no]-feature-accessibility. The following pairs have identical effects:

  • -accessibility or -feature-accessibility
  • -no-accessibility or -no-feature-accessibility

Values:

  • boolean options are given to configure as -option and -no-option, meaning true and false, respectively.
  • all other options are given as -option value.

Feature Options

The features value lists the features available in a given module. The features are effectively booleans. They are all enabled by default, subject to passing configuration tests that enable them.

To control a feature foo:

  • -no-feature-foo disables the feature. E.g. to disable the iconv feature, you'd do configure -no-feature-iconv [...].
  • -feature-foo enables the feature and ensures that it is available. This will cause an error if a configuration test for the feature fails. It's useful in build systems that build a particularly configured Qt along with your application: it ensures that the features your code depends on will be available.

Failing Builds

Generally speaking, no matter what combination of feature selections you provide, if configure doesn't fail, the build is supposed to succeed.

we'd all like to avoid wasting time on builds that will start building despite an improper configuration

The configure tool will detect any invalid configurations. If configure succeeds yet the build fails, it's a Qt bug and you should report it.

查看更多
Root(大扎)
4楼-- · 2020-02-05 04:08

The changes that are behind my failed configuration:

  • there is no longer the option to specify whether sql support is built-in or plug-in, so the format is now just -sql-<driver>, the documentation is still not updated and lists the old format - -<option>-sql-<driver>.

  • the -l option to add a specific library has been removed, which is turning out to be problematic in multiple areas.

Edit: Also, this blog entry just posted on doing lite builds might be useful.

查看更多
登录 后发表回答