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

Investigate calling qt_find_package and qt_config_compile_test only for specific platforms based on feature conditions

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Build System: CMake
    • None
    • fcb548878 (dev)

    Description

      Currently most qt_find_package and qt_config_compile_test calls are executed regardless of platform.
      Finding packages like Libinput on Windows doesn't really make sense, and only slows down configurations and reconfigurations.
      Same for compile tests like GObject.

      We should investigate if we can limit these calls only to their relevant platforms.

      The best way to do it would be to leverage the conditions in qt_feature calls, and lazy execute qt_find_packages / qt_config_compile_test for variables (like Libinput_FOUND or TARGET Libinput or HAVE_TEST_egl_x11) that appear in that feature's condition. This is what qmake does in qt 5.
      It will likely prove difficult to implement in cmake, because our qt_find_package / qt_config_compile_test calls are imperative, and not declarative, there are cmake scoping issues to consider, order of calls, etc.

      A less ideal way would be to wrap all qt_find_package / qt_config_compile_test calls in if conditions (duplicated from the feature definitions) at the call site.
      This would require time figuring which package and compile test is used by which feature in which conditions, and duplicating that condition.
      It's relatively easy to do, and can be done incrementally.
      The downside is condition duplication, and that certain packages / compile tests will always be looked up, even if a feature or other dependent is not enabled by default (AUTODETECT = OFF).
      We could still do some coarse grained conditions like never look up x11 packages and tests by default when targeting MSVC.

      There might be other alternative solutions to consider as well, but these are the main two.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes