Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile on multiple cores using mingw inside QTCreator

Tags:

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!

like image 646
Stephen Cheng Avatar asked Feb 23 '12 20:02

Stephen Cheng


1 Answers

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.

like image 77
kenrogers Avatar answered Sep 19 '22 17:09

kenrogers