Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Cmake recompile qml modules even if the qml files did not change.
Qt 6.11 is out! See what's new in the release blog

Cmake recompile qml modules even if the qml files did not change.

Scheduled Pinned Locked Moved Solved Qt 6
4 Posts 4 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by
    #1

    Hi everyone.

    I create applications that use qt6_add_qml_module cmake to define qml modules and export the targets to link in other applications.

    The thing is, that every time a compile a project that creates a qml module the compiler rebuilds things like :

    [ 48%] Building CXX object _deps/account-build/CMakeFiles/account.dir/account_qmltyperegistrations.cpp.o
    [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/AccountQml_qml.cpp.o
    [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/ShowSeed_qml.cpp.o
    [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/RestoreAccount_qml.cpp.o
    [ 50%] Linking CXX shared library libaccount.so
    

    Although the source code of the account qml module did have not changed.

    This take time if you have many targets that define a qml module.
    Is there a way to stop this behavior?

    One example of my cmake configuration here.

    Thank you in advance for your time.

    D JKSHJ 2 Replies Last reply
    0
    • MesrineM Mesrine

      Hi everyone.

      I create applications that use qt6_add_qml_module cmake to define qml modules and export the targets to link in other applications.

      The thing is, that every time a compile a project that creates a qml module the compiler rebuilds things like :

      [ 48%] Building CXX object _deps/account-build/CMakeFiles/account.dir/account_qmltyperegistrations.cpp.o
      [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/AccountQml_qml.cpp.o
      [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/ShowSeed_qml.cpp.o
      [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/RestoreAccount_qml.cpp.o
      [ 50%] Linking CXX shared library libaccount.so
      

      Although the source code of the account qml module did have not changed.

      This take time if you have many targets that define a qml module.
      Is there a way to stop this behavior?

      One example of my cmake configuration here.

      Thank you in advance for your time.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #4

      @Mesrine said in Cmake recompile qml modules even if the qml files did not change.:

      Is there a way to stop this behavior?

      You have 2 options:

      • Use the Ninja generator instead of the Makefile generator (recommended), OR
      • Upgrade to Qt 6.5.2 (see https://bugreports.qt.io/browse/QTBUG-106683 )

      Note that Qt 6.5.2 no longer causes the Makefile generator to rebuild the *.o and *.so files unnecessarily, but there are still other inefficiencies: https://bugreports.qt.io/browse/QTBUG-115166

      @d_h_mcinnes said in Cmake recompile qml modules even if the qml files did not change.:

      I notice that if I build my project from the command line, it rebuilds the .qml files every time. However, if I build from inside qtcreator, it only rebuilds when necessary.

      It sounds like Qt Creator uses the Ninja generator but your command line does not.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      3
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #2

        as I understand it, this is normal, qt_add_qml_module adds the qml files to the executable as if they were declared in a qrc file, and still if I understand things right, this step is done at build time.

        1 Reply Last reply
        0
        • MesrineM Mesrine

          Hi everyone.

          I create applications that use qt6_add_qml_module cmake to define qml modules and export the targets to link in other applications.

          The thing is, that every time a compile a project that creates a qml module the compiler rebuilds things like :

          [ 48%] Building CXX object _deps/account-build/CMakeFiles/account.dir/account_qmltyperegistrations.cpp.o
          [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/AccountQml_qml.cpp.o
          [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/ShowSeed_qml.cpp.o
          [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/RestoreAccount_qml.cpp.o
          [ 50%] Linking CXX shared library libaccount.so
          

          Although the source code of the account qml module did have not changed.

          This take time if you have many targets that define a qml module.
          Is there a way to stop this behavior?

          One example of my cmake configuration here.

          Thank you in advance for your time.

          D Offline
          D Offline
          d_h_mcinnes
          wrote on last edited by d_h_mcinnes
          #3

          @Mesrine , I had this issue as well. Then, I noticed that if I built the qt example project 'qml-i18n' (on my machine, this is installed at /opt/Qt/Examples/Qt-6.5.2/qml/qml-i18n) the .qml files are not recompiled every time. This example project also uses 'qt_add_qml_module'. I think there must be some difference in the CMakeLists.txt file. If you find out what it is, please let me know!

          I notice that if I build my project from the command line, it rebuilds the .qml files every time. However, if I build from inside qtcreator, it only rebuilds when necessary.

          1 Reply Last reply
          0
          • MesrineM Mesrine

            Hi everyone.

            I create applications that use qt6_add_qml_module cmake to define qml modules and export the targets to link in other applications.

            The thing is, that every time a compile a project that creates a qml module the compiler rebuilds things like :

            [ 48%] Building CXX object _deps/account-build/CMakeFiles/account.dir/account_qmltyperegistrations.cpp.o
            [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/AccountQml_qml.cpp.o
            [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/ShowSeed_qml.cpp.o
            [ 50%] Building CXX object _deps/account-build/CMakeFiles/account.dir/.rcc/qmlcache/account_qml/RestoreAccount_qml.cpp.o
            [ 50%] Linking CXX shared library libaccount.so
            

            Although the source code of the account qml module did have not changed.

            This take time if you have many targets that define a qml module.
            Is there a way to stop this behavior?

            One example of my cmake configuration here.

            Thank you in advance for your time.

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #4

            @Mesrine said in Cmake recompile qml modules even if the qml files did not change.:

            Is there a way to stop this behavior?

            You have 2 options:

            • Use the Ninja generator instead of the Makefile generator (recommended), OR
            • Upgrade to Qt 6.5.2 (see https://bugreports.qt.io/browse/QTBUG-106683 )

            Note that Qt 6.5.2 no longer causes the Makefile generator to rebuild the *.o and *.so files unnecessarily, but there are still other inefficiencies: https://bugreports.qt.io/browse/QTBUG-115166

            @d_h_mcinnes said in Cmake recompile qml modules even if the qml files did not change.:

            I notice that if I build my project from the command line, it rebuilds the .qml files every time. However, if I build from inside qtcreator, it only rebuilds when necessary.

            It sounds like Qt Creator uses the Ninja generator but your command line does not.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            3
            • MesrineM Mesrine has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved