Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-90820

Build examples as external projects within the main build

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.0.0, 6.5.1
    • Build System: CMake
    • None
    • All
    • 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

          For Gerrit Dashboard: QTBUG-90820
          # Subject Branch Project Status CR V

          Activity

            People

              alexandru.croitor Alexandru Croitor
              crscott Craig Scott
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are 2 open Gerrit changes