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. Speed up make or/and ninja building proccess
Forum Updated to NodeBB v4.3 + New Features

Speed up make or/and ninja building proccess

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 823 Views 2 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.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by
    #1

    Is there any way to ignore some unnecessary lines (pre-compiled headers way) to speed up make and ninja building process?

    sierdzioS JoeCFDJ 2 Replies Last reply
    0
    • J JacobNovitsky

      Is there any way to ignore some unnecessary lines (pre-compiled headers way) to speed up make and ninja building process?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Things to look into:

      • always pick ninja, make is always slower
      • use jumbo builds (UNITY_BUILD, UNITY_BUILD_MODE, UNITY_BUILD_BATCH_SIZE)
      • use ccache
      • clean up your includes, use forward declarations as much as possible, never include whole Qt modules

      (Z(:^

      J S 2 Replies Last reply
      2
      • J JacobNovitsky

        Is there any way to ignore some unnecessary lines (pre-compiled headers way) to speed up make and ninja building process?

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        @JacobNovitsky Try meson out. It seems that meson is (much) quicker than cmake. I tested to install a third party package with cmake and meson. Meson is way faster than cmake. I am planning to switch to meson soon.

        1 Reply Last reply
        0
        • sierdzioS sierdzio

          Things to look into:

          • always pick ninja, make is always slower
          • use jumbo builds (UNITY_BUILD, UNITY_BUILD_MODE, UNITY_BUILD_BATCH_SIZE)
          • use ccache
          • clean up your includes, use forward declarations as much as possible, never include whole Qt modules
          J Offline
          J Offline
          JacobNovitsky
          wrote on last edited by
          #4

          @sierdzio hi! thank you for the reply!

          always pick ninja, make is always slower -> is there something I shoud change in Qt Creator preferences?

          sierdzioS 1 Reply Last reply
          0
          • J JacobNovitsky

            @sierdzio hi! thank you for the reply!

            always pick ninja, make is always slower -> is there something I shoud change in Qt Creator preferences?

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @JacobNovitsky said in Speed up make or/and ninja building proccess:

            @sierdzio hi! thank you for the reply!

            always pick ninja, make is always slower -> is there something I shoud change in Qt Creator preferences?

            No, Qt Creator uses ninja by default.

            (Z(:^

            1 Reply Last reply
            0
            • sierdzioS sierdzio

              Things to look into:

              • always pick ninja, make is always slower
              • use jumbo builds (UNITY_BUILD, UNITY_BUILD_MODE, UNITY_BUILD_BATCH_SIZE)
              • use ccache
              • clean up your includes, use forward declarations as much as possible, never include whole Qt modules
              S Offline
              S Offline
              SimonSchroeder
              wrote on last edited by
              #6

              @sierdzio said in Speed up make or/and ninja building proccess:

              never include whole Qt modules

              Well, with pre-compiled headers (for the Qt modules) this should not be much of a problem. (Though, I don't advise to include whole Qt modules.) Most important is that you only have 3rd party libraries in your pre-compiled header and not your own code. Otherwise a change in one of your headers will trigger a recompile of the pre-compiled header and as a dependency a recompile of everything else as well.

              I have tried several different tools for caching on Windows. This was way too complicated to achieve for a qmake-based project. In the end I decided on FASTBuild which is a single tool for unity/jumbo builds, caching and distributed compilation. However, it is not compatible with CMake, but replaces CMake as well (though, probably not the best replacement for CMake). I have created a bunch of scripts to convert a qmake-based project into a FASTBuild project (https://github.com/SimonSchroeder/QMake2Fastbuild). I would love for CMake to have a FASTBuild generator.

              J 1 Reply Last reply
              3
              • S SimonSchroeder

                @sierdzio said in Speed up make or/and ninja building proccess:

                never include whole Qt modules

                Well, with pre-compiled headers (for the Qt modules) this should not be much of a problem. (Though, I don't advise to include whole Qt modules.) Most important is that you only have 3rd party libraries in your pre-compiled header and not your own code. Otherwise a change in one of your headers will trigger a recompile of the pre-compiled header and as a dependency a recompile of everything else as well.

                I have tried several different tools for caching on Windows. This was way too complicated to achieve for a qmake-based project. In the end I decided on FASTBuild which is a single tool for unity/jumbo builds, caching and distributed compilation. However, it is not compatible with CMake, but replaces CMake as well (though, probably not the best replacement for CMake). I have created a bunch of scripts to convert a qmake-based project into a FASTBuild project (https://github.com/SimonSchroeder/QMake2Fastbuild). I would love for CMake to have a FASTBuild generator.

                J Offline
                J Offline
                JacobNovitsky
                wrote on last edited by JacobNovitsky
                #7

                @SimonSchroeder, Simon, thanks for sharing, I just about to research whole thing and make something like your script, maybe using some cache methods to discard unnecessary transactions

                Ubuntu, 6.2.4, gcc, qmake
                already have some automation script for qmake, but never dived into building engine yet
                how to amend your project for ubuntu?

                S 1 Reply Last reply
                0
                • J JacobNovitsky

                  @SimonSchroeder, Simon, thanks for sharing, I just about to research whole thing and make something like your script, maybe using some cache methods to discard unnecessary transactions

                  Ubuntu, 6.2.4, gcc, qmake
                  already have some automation script for qmake, but never dived into building engine yet
                  how to amend your project for ubuntu?

                  S Offline
                  S Offline
                  SimonSchroeder
                  wrote on last edited by
                  #8

                  @JacobNovitsky said in Speed up make or/and ninja building proccess:

                  how to amend your project for ubuntu?

                  Most of the things should work right away on Linux as well. The batch scripts (in the scripts folder) mostly work as a bash script also. grep and sed should be available by default on Linux or are easy to install through the package manager. Only generateInputFiles4Fbuild.bat needs a little more adjustment. You don't need to load Visual Studio (or any compiler for that matter) and just need to adjust the path to qmake. Also, rmdir needs to be replace by a simple rm -r.

                  A little bit more involved is the adjustment of the .bff files. It should be fairly easy to adjust the paths of the .bff includes in the Qt subfolder. Certainly you need to replace the Visual Studio folder by a GCC or Clang folder. My inspiration for the general setup came from the .bff files for building FASTBuild itself. Have a look over there how to set up a GCC or Clang folder. The only additional thing they do is to copy the compiler explicitly to other machines during distributed builds. The toolchain (i.e. Windows or Linux, GCC or Clang (if you have both as option)) is selected in the fbuild.bff file. IIRC you can have a look at the FASTBuild setup itself for how to select the toolchain inside this file.

                  One last thing is which compiler/linker flags to choose. For this I ran qmake once initially and had a look at the generated Makefile. These are the flags I set inside fbuild.bff and I think there are more (especially some default libs) inside the Visual Studio folder.

                  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