我可以使用 incredibuild 作为 Visual Studio 扩展包来使用许多 CPU 构建我的代码。
我也可以使用 xgconsole msbuild ... 命令。
但是,如果我想同时添加一些其他任务以及 vc build。所以我尝试了一些方法:
使用批处理 config.bat:
xgSubmit /command task1 xgSubmit /command task2 msbuild ***.sln /t:rebuild
然后使用命令
xgConsole /command="config.bat" /profile=pro.xml
我的 pro.xml 如下:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Profile FormatVersion="1">
<Tools>
<Tool Filename="MSBuild" AllowIntercept="true" />
<Tool Filename="Tracker" AllowIntercept="true" />
<Tool Filename="CL" AllowIntercept="true" />
<Tool Filename="Tracker" AllowRemote="true" />
<Tool Filename="CL" AllowRemote="false" />
</Tools>
</Profile>
但问题是,tracker进程创建了一个cl进程,然后cl进程又创建了很多其他的cl进程。所以我在 xml 配置文件中将 cl 设置为 AllowIntercept 和 AllowRemote。但是有了这个xml配置,xgconsole不能将cl进程分派给其他cpu,只会报错。
- 所以我尝试了另一种方法:我将 Visual Studio cl.exe 重命名为 clChild.exe,并备份另一个,将其命名为 clorigin.exe。
然后我设计了自己的cl.exe
. 在我自己的cl.exe
中,我检查父进程是否是tracker.exe
,然后我启动clorigin.exe
,并将命令 para 传递给它,然后等待clorigin.exe
终止;如果父进程是cl.exe
,那么我开始clchild.exe
。
但是这种方式也是没有用的。简单地说,你可以认为它没有用。
所以我想也许我不应该启动clorigin.exe
by StartProcess
API,它只是启动另一个进程;也许我应该作为execute
unix中的api来做,当启动一个子进程时,在taskmanager中它只能看到父进程,这意味着父进程只是完成另一个exe的任务,而不是创建一个新的进程ID?
也许我认为是错误的方式,但是如何让其他任务与Visual Studio同时编译任务共享并被分派到多个cpu?