使用MSBuild将/MP选项传递给编译器 [英] Pass /MP option to the compiler using MSBuild

查看:106
本文介绍了使用MSBuild将/MP选项传递给编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用MSBuild从命令行构建的VC项目文件.我想指定/MP标志而无需编辑项目文件.那可能吗? 在调用MSBuild之前,我已经尝试过set CL=/MP,但是它没有任何作用.

I have a VC project file that I'm building from command line using MSBuild. I want to specify the /MP flag without editing the project file. Is that possible? I've tried set CL=/MP prior to calling MSBuild, but it has no effect.

推荐答案

这可以通过访问CL_MPCount Visual Studio选项来完成:

This can be accomplished by accessing the CL_MPCount Visual Studio option:

MSBuild /m:2 /p:CL_MPCount=2 /p:Configuration=Release tf_tutorials_example_trainer.vcxproj

以上指示编译器最多执行2个并行编译任务. /m:2标志允许MSBuild并行构建两个项目.最终结果是,我们最多有4个cl.exe进程并行运行.

The above instructs the compiler to perform a maximum of 2 parallel compilation tasks. The /m:2 flag allows MSBuild to build two projects in parallel. The net result is that we have a maximum of 4 cl.exe processes running in parallel.

更新:CL_MPCount=2标志作为/MP2传递给cl.exe.这样可以在同一项目中并行编译2个.cpp文件.

UPDATE: The CL_MPCount=2 flag gets passed on to cl.exe as /MP2. This allows parallel compilation of 2 .cpp files within the same project.

这篇关于使用MSBuild将/MP选项传递给编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆