How to compile on multiple cores using mingw inside QTCreator

Stephen Cheng picture Stephen Cheng · Feb 23, 2012 · Viewed 26.3k times · Source

I have a quad-core i7 CPU on my windows desktop. I am trying to get mingw32-make to compile using as many core as possible. I have added -j8 into the "Make Arguments" fields under Build Settings->Build Steps. mingw32-make seems to completely ignore the option since I don't get any speed improvement out of that. When I view the CPU usage in task manager, it stays at 13% and I only see one instance of g++ running.

Right now, rebuilding the whole project using mingw takes 3 full minutes. Rebuilding it using MSVC takes only 15 seconds.

For your information, I have enabled the precompiled header option in the project settings. That makes things a lot quicker with VC as well. But I am still yet to see the benefit of precompiled header with mingw.

Please share your comments if you have ever got mingw to compile multiple source files in parallel from QTCreator. Thanks!

Answer

kenrogers picture kenrogers · Feb 23, 2012

Here's what I did.

In the Tools -> Options menu in Qt Creator, under the "Build and Run" section there's an option that says "Use jom instead of nmake". I checked that box, but nothing changed. So instead, I went to the project's build settings and under the build steps category there is a "Make" item. Expand the details on that and you'll find a "Override mingw32-make.exe:" item. I pasted "C:\QtSDK\QtCreator\bin\jom.exe" in there, and suddenly I was building with multiple cores.

Worked for me on Qt Creator 2.4.1. Give it a try.