Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. half-ordered qmake subdirs for optimal compilation speed?

half-ordered qmake subdirs for optimal compilation speed?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 471 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.
  • T Offline
    T Offline
    thierryhenry14
    wrote on last edited by
    #1

    I have a qmake project consisting of multiple subprojects. Like this:

    TEMPLATE= subdirs
    CONFIG += ordered
    SUBDIRS = commonlib proj1 proj2 projN
    

    Every project is independent, but depends on the commonlib static library, so it has to be built first. Each subprojects' .pro file has:

    LIBS += ../libs/libCommonLib.a
    PRE_TARGETDEPS += ../libs/libCommonLib.a
    

    Because make can only build them one at a time (due to "ordered"), half my compilation time is spent without all 8 of my CPU cores. Sometimes it's using as little as 1 core for like 10 seconds as it builds the final file for preceding projects.

    Is there a way to fix this?

    J.HilkJ 1 Reply Last reply
    0
    • T thierryhenry14

      I have a qmake project consisting of multiple subprojects. Like this:

      TEMPLATE= subdirs
      CONFIG += ordered
      SUBDIRS = commonlib proj1 proj2 projN
      

      Every project is independent, but depends on the commonlib static library, so it has to be built first. Each subprojects' .pro file has:

      LIBS += ../libs/libCommonLib.a
      PRE_TARGETDEPS += ../libs/libCommonLib.a
      

      Because make can only build them one at a time (due to "ordered"), half my compilation time is spent without all 8 of my CPU cores. Sometimes it's using as little as 1 core for like 10 seconds as it builds the final file for preceding projects.

      Is there a way to fix this?

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @thierryhenry14 yes, don't use ordered!

      rather use depends


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • T Offline
        T Offline
        thierryhenry14
        wrote on last edited by
        #3

        Thanks J Hilk.

        Unfortunately .depends is not supported on Qt 4.8, which is what this legacy project is made with. I would like to port it to Qt 5.15, but this could take some time as the embedded Linux it runs on is extremely ancient.

        J.HilkJ 1 Reply Last reply
        0
        • T thierryhenry14

          Thanks J Hilk.

          Unfortunately .depends is not supported on Qt 4.8, which is what this legacy project is made with. I would like to port it to Qt 5.15, but this could take some time as the embedded Linux it runs on is extremely ancient.

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @thierryhenry14 thats unfortunate, but you nowhere states its a Qt 4 project :P

          I do not know of a qt4 substitute for depends, maybe someone else can help here.

          My suggestion/workaround would be:
          give your commonlib a main.cpp and make it a "standalone project"

          then you can select it in QtCreator and build it first, and then build (unordered) the rest of your project. Use pre/post make to copy the static library around, if necessary


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            You are making a mistake. Qt 4.8 already has support for depends. See the 4.8 SUBDIRS variable documentation.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            T 1 Reply Last reply
            2
            • SGaistS SGaist

              Hi,

              You are making a mistake. Qt 4.8 already has support for depends. See the 4.8 SUBDIRS variable documentation.

              T Offline
              T Offline
              thierryhenry14
              wrote on last edited by
              #6

              @SGaist said in half-ordered qmake subdirs for optimal compilation speed?:

              Hi,

              You are making a mistake. Qt 4.8 already has support for depends. See the 4.8 SUBDIRS variable documentation.

              Oops, I misunderstood the wiki saying "Qt 4.8.x does not support it at all ", it seems that applies only to Visual Studio. Thanks!

              1 Reply Last reply
              0

              • Login

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