Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt5 + cmake = SLOW moc.exe
Forum Updated to NodeBB v4.3 + New Features

Qt5 + cmake = SLOW moc.exe

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 4 Posters 2.6k 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.
  • P Offline
    P Offline
    pip010
    wrote on last edited by
    #1

    I'am experiencing some abysmal compilation time when it comes to building a relatively small Qt5 app in windows.

    The problem resembles alot the reported here issue : http://lists.qt-project.org/pipermail/interest/2015-January/014812.html

    In case one uses cmake+qt5 to build on windows and have additional projects (in my case VTK/ITK/Boost)
    moc.exe will go first over all visible to cmake paths, some windows ones, then finally in C:/Qt to find its headers.
    So for generating one cpp file from moc.exe I end up with a few million IO operations! ine can use procmon.exe to inspect moc.exe on windows.
    Rebuilding from scratch takes ages compared to what takes <5min before switching to Qt :((((

    MOC cannot go in parallel (pre-processor!!!)

    at that point I'm faced with a few options to explore, however I expect something of official HOW-TO on cmake+qt integration.

    It might be a Qt5 or/and Cmake issue, hard to tell, since I'm not expert in either.

    Can someone with more inside take a look please !?

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

      Hi,

      How many includes do you have in your header files ? Are some of them module includes like e.g. #include <QtWidgets> ?

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        asanka424
        wrote on last edited by
        #3

        one possible refactoring you could do to make your compilation fast is use forward declaration in all possible places.

        1 Reply Last reply
        0
        • jacmoeJ Offline
          jacmoeJ Offline
          jacmoe
          wrote on last edited by
          #4

          What does your CMakeLists look like?
          I haven't experienced that sort of behaviour with Windows and Qt5.

          Less noise - more signal

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pip010
            wrote on last edited by
            #5

            I think I nailed it. It has to do with auto_moc(on) in cmake as well as the fact I do introduced big ass projects (ITk&VTK&BOOST) on board.
            Also I tried linux with gnu-makefiles and moc runs fast. So it is also specific to VS.
            Having one monolithic application (single cmake target) does not help either.
            I did split the project in a few static libs and it seems better already, though a clean rebuild still takes forever :(

            So the only solutions I can think of:
            Disable auto moc and do manual moc in cmake. People have reported some auto_moc problems before.
            Switch to dev in Linux. Right now it takes equal time to build all my dependencies and the project to just building the project under win :D

            Note: Not a Qt issue. I posted here cause my initial feeling was it was occurring only in Qt5 (Qt4 is affected too however). So might escalate on cmake mailing lists.

            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