How to change the amount of building threads in Xcode?

I'm building a couple of C++ files in xcode that take a lot of memory to compile (+1 GB / file). Because I do this on my dual core laptop, xcode uses 2 threads for building. The two threads will eventually be building the files that take a lot of memory simultaneously so the system suffers memory starvation and the compilation grinds to a near halt.

A sufficient solution for me would be to force Xcode to use only one build thread. Does anybody know a way to change how many build threads Xcode uses?

For those who are interested, the C++ files contain a sizable boost::spirit::qi parser.

Answers


The number of threads Xcode is using to perform tasks is controlled by PBXNumberOfParallelBuildSubtasks option. You can change it with the following command: - defaults write com.apple.Xcode <key> <value>. For example:

defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 8

See Xcode User Defaults for more details.

There are also many other ways to speed up a compilation, from precompiled headers to distributed builds. Read Reducing Build Times for more information on this.

Good luck!


Need Your Help

Using Reflection to Count Methods.

java

I have to write a function

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.