views:

3071

answers:

6

I just got a new quad core computer and noticed that nmake is only using 1 process.

I used to use make which had the switch -j4 for launching 4 processes. What is the nmake equivalent?

[edit] Based on the information below I have been able to add a command to my qmake project file:

QMAKE_CXXFLAGS += /MP

Which effectively did it for me. Many thanks.

+3  A: 

Quick googling gives: http://msdn.microsoft.com/en-us/library/bb385193.aspx

Marcin Gil
that's parallel compilation of multiple .cpp files in the same invocation of the compiler - not parallel building of multiple 'make' targets
Alnitak
It's very interesting, how to switch on this switch in VS2008! I can't find it
abatishchev
it's not an "nmake" option, it's a "c1" option (i.e. for use with the command line compiler)
Alnitak
Yeap, cl.exe, so it must be possible to use in Visual Studio, as far as it calls it directly, I guess, not using nmake. Or I'm not right?
abatishchev
Didn't Visual Studion use that switch by default? I remember it batch compiling files already.
MSalters
Yes the IDE will use it by default, it just starts two instances of cl - but you can't use it with nmake.
Martin Beckett
+6  A: 

According to MSDN, there's no such option for 'nmake'.

It is possible to get parallel compiles using the /MP option with the VC++ command line compiler:

> cl /MP a.cpp b.cpp c.cpp

However most makefiles don't put multiple source files into a single invocation of the compiler - it's far more common for the .cpp files to be compiled to .o files individually.

Alnitak
Only not .o, but .obj. VC++ compilers generates .obj, GCC - .o, AFAIK
abatishchev
A convenient way to use this flag is to let cl.exe retrieve it from the "CL" environment variable. Set it in your system properties or type it on the command line: "set CL= /MP"
total
+1  A: 

Incredibuild claims to be able to run nmake builds on multiple cores / multiple machines. I don't have any experience of it.

Martin Beckett
A: 

This doesn't work for normal makefiles, but there is a setting in Visual Studio 2005 that lets you build more than one .vcproj file at the same time (provided one isn't dependent on the other). Tools -> Options -> Projects and Solutions -> Build and Run -> X maximum number of parallel project builds.

teeks99
+8  A: 

QT have tool supposed for this http://qt.gitorious.org/qt-labs/jom

Tolik Odukha
Excellent find!!
SPWorley
Precompiled jom binaries are here: ftp://ftp.qt.nokia.com/jom/
Lucas
+1  A: 

The CMake 2.8.1 RC1, as for the time of writing this it's ready to try, does bring new generator for NMake which is called NMake Makefiles JOM and it generates NMake with specific settings for jom, which is the drop in replacement of NMake. Thus, it gives multi-processing enabled building using NMake.

mloskot