Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1579

Must add project's own source directory to cpp.includePaths in order to get new QML type registration to work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Out of scope
    • Affects Version/s: 1.16.0
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None

      Description

      I'm trying out the new QML import support (QBS-1531):

      https://github.com/mitchcurtis/slate/commit/26344781ffaf1006445b76adefd0e8e01ec03bf4#diff-0b0ebc8a92a44b173a51df2ce749a742

      A .cpp file is generated as expected:

      /home/mitch/dev/slate-qt_dev_debug_no_asan-Debug/Debug_qt_dev_d_750558401e966ce4/lib.9d062baf/slate_qmltyperegistrations.cpp

      but the first include from my project in that file cannot be found:

      #include <QtQml/qqml.h>
      #include <QtQml/qqmlmoduleregistration.h>
      
      #include <animationplayback.h> // <===
      ...
      

      From looking at the change, I can see where the *_qmltyperegistrations file is created:

      https://codereview.qt-project.org/c/qbs/qbs/+/293160/3/share/qbs/module-providers/Qt/templates/qml.qbs#84

      but I don't see where it's included as part of the project's sources. In qmake, it seems to be done here:

      https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qmltyperegistrar/qmltypes.prf#n77

      Adding the project's own source directory to cpp.includePaths fixes it:

          cpp.includePaths: [
              product.sourceDirectory + "/3rdparty",
              "."
          ]
      

      However, I don't think this is necessary with qmake, so I wonder if it should be necessary with qbs.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              kandeler Christian Kandeler
              Reporter:
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes