1

我可以使用 incredibuild 作为 Visual Studio 扩展包来使用许多 CPU 构建我的代码。

我也可以使用 xgconsole msbuild ... 命令。

但是,如果我想同时添加一些其他任务以及 vc build。所以我尝试了一些方法:

  1. 使用批处理 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,只会报错。

  1. 所以我尝试了另一种方法:我将 Visual Studio cl.exe 重命名为 clChild.exe,并备份另一个,将其命名为 clorigin.exe。

然后我设计了自己的cl.exe. 在我自己的cl.exe中,我检查父进程是否是tracker.exe,然后我启动clorigin.exe,并将命令 para 传递给它,然后等待clorigin.exe终止;如果父进程是cl.exe,那么我开始clchild.exe

但是这种方式也是没有用的。简单地说,你可以认为它没有用。

所以我想也许我不应该启动clorigin.exeby StartProcessAPI,它只是启动另一个进程;也许我应该作为executeunix中的api来做,当启动一个子进程时,在taskmanager中它只能看到父进程,这意味着父进程只是完成另一个exe的任务,而不是创建一个新的进程ID?

也许我认为是错误的方式,但是如何让其他任务与Visual Studio同时编译任务共享并被分派到多个cpu?

4

1 回答 1

1

使用 IncrediBuild Visual Studio 插件(或 BuildConsole 命令)是使用 IncrediBuild 执行解决方案的最简单和最优化(性能方面)的方法。如果您更喜欢使用自定义配置文件执行构建,您的 profile.xml 应如下所示(请注意不应在配置文件中提及跟踪器):

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <Profile FormatVersion="1"> <Tools> <Tool Filename="MSBuild" AllowIntercept="true" /> <Tool Filename="cl" AllowRemote="True" DeriveCaptionFrom="lastparam" VCCompiler="True" VCCompilerUnbatch="True" /> <Tool Filename="link" AllowRemote="false" DeriveCaptionFrom="firstparam" VCLinker="True" MonitorFileChanges="true" />

</Tools> </Profile>

(作者在 IncrediBuild 工作)

于 2015-04-05T08:47:05.770 回答