Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.0.0, 6.5.1
-
None
-
-
4e70ab5ee (dev), 432083949 (tqtc/lts-6.2), abe3e465b (tqtc/lts-6.2), 72de1af9e (tqtc/lts-6.2), 15cfb9392 (dev), 4a71a001a (tqtc/lts-6.5), aacc31815 (dev), 56d1754c2 (6.7), 68b2e1db0 (dev), 2a54183be (6.6), 4a45c5f2e (dev), ae53b20f2 (dev), 17fbd90a5 (6.7)
Description
When using a static Qt, we can't build examples as part of the main Qt build due to issues with cyclic dependencies between the main Qt module libraries and the plugins (see QTBUG-90819). We would have to manually link to the plugins in every example, but this is something that user projects wouldn't need to do and the examples would then be tainted with things that are only relevant to building Qt itself.
Ideally, we want the examples to be built in their own separate build. They should build against the Qt that the main build provides somehow. A potential solution to this is to move the examples out to their own test case(s) and make use of the ctest --build-and-test functionality. That ctest featureĀ is specifically meant for situations like this, where you want to verify that a project can be configured and built.
While it would be nice to make every single example its own separate test case, that would have a fairly strong negative impact on test time. Every sub-build will need to do a full CMake run, which means performing compiler checks, etc. and this can take several seconds with some generators. We can minimise this impact by grouping examples by functionality, feature, etc. such that one test case builds multiple examples. We could potentially offer a CMake option for fine-grained tests if the user wanted it.
Tests support labels in CMake. We could potentially assign some labels based on the module, etc. for each example or group of examples. This would enable the developer to select just the subset of tests for the examples they want.
A further advantage of this approach is that it may open up the opportunity for building the examples against an existing Qt installation, similar to how we currently support the standalone test capabilities. This may have some advantages for CI as well.
Attachments
Issue Links
- blocks
-
QTBUG-101340 Use qt_generate_deploy_qml_app_script MACOS_BUNDLE_POST_BUILD in QML examples
- In Progress
- is duplicated by
-
QTBUG-90579 building qtbase with -DBUILD_SHARED_LIBS=OFF leads to endless cmake loop
- Closed
- is required for
-
QTBUG-112489 QML examples installation is bogus
- Reported
-
QTBUG-86669 Investigate automatic calling of qt6_import_qml_plugins for examples using a static Qt build
- Closed
-
QTBUG-102057 Use CMake deployment API in Qt examples once the API is out of TP
- In Progress
- relates to
-
QTBUG-86669 Investigate automatic calling of qt6_import_qml_plugins for examples using a static Qt build
- Closed
-
QTBUG-90819 Linking relationships to plugins are incorrectly specified
- Closed
-
QTBUG-98545 Provide CMake API for deployment support
- Closed
-
QTBUG-112135 Add CMake target for installing sources of Qt examples
- Closed
-
QTBUG-90884 Localstorage example
- Closed
-
QTBUG-110369 AUTOUIC can't handle relative paths referring to parent dirs with Ninja Multi-Config
- Reported
-
QTBUG-102056 Remove usage of INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR in examples
- Reported
- resulted in
-
QTBUG-101290 Unable to build examples when building as module with -DQT_BUILD_EXAMPLES=ON
- Closed
-
QTBUG-123100 Support per-directory building of ExternalProject examples
- Reported
-
QTBUG-123096 Examples should be added via qt_internal_add_example instead of add_subdirectory
- In Progress
-
QTBUG-96232 Figure out how to build examples as ExternalProjects in a prefix build setup so it can be used in the CI
- In Progress
Gerrit Reviews
For Gerrit Dashboard: QTBUG-90820 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
394002,28 | CMake: Re-enable building external examples in prefix builds | dev | qt/qtbase | Status: NEW | -2 | -1 |
431085,14 | WIP: CMake: Test examples as external projects | dev | qt/qt5 | Status: NEW | -2 | -1 |