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

Build examples as external projects within the main build

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.0.0
    • Fix Version/s: None
    • Component/s: Build System: CMake
    • Labels:
      None

      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

              Assignee:
              qtbuildsystem Qt Build System Team
              Reporter:
              crscott Craig Scott
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews