1

We are using Intel C++ compiler for improving the performance of our C++ code. In order to use it, we need to convert our visual studio project into intel project through the IDE. Since Intel compiler isn't installed everywhere, hence we do this step only on those machines where we need to create intel builds.

We wanted to explore a method to automate this conversion process through some script. We were wondering if we could use EnvDTE API to do the same.

So far we have been able to reach up to the following in VBScript:

Dim objDTE
' Creates an instance of the Visual Studio  
Set objDTE = CreateObject("VisualStudio.DTE")  

' Make it visible   
objDTE.MainWindow.Visible = True  

' Open a .sln file   
objDTE.Solution.Open("Path to solution file")  

Dim sol    
Set sol = objDTE.Solution.SolutionBuild  

At this point we can call functions like this:

sol.Clean  
sol.Build  

and they run fine.

Beyond this, we couldn't figure out a way to identify other commands which could be applied on a solution. For example, Intel C++ Compiler integrates itself as a plugin to Visual Studio. We were wondering if we could figure out a way to identify the list of commands available to the solution object and then execute the appropriate command to convert the visual studio project to use Intel Compiler.

Is it possible to automate this conversion?

Thanks in advance.

4

2 回答 2

0

为了那些可能会遇到同样情况的人的利益 - 您可以使用 DTE.ExecuteCommand 运行任意命令,包括那些由扩展公开的命令。要打印出所有可用命令的列表,您可以运行以下 VBScript:

Set DTE = CreateObject("VisualStudio.DTE.10.0") ' adjust version as needed
For Each cmd In DTE.Commands
    WScript.Echo cmd.Name
Next
于 2011-04-27T17:27:54.097 回答
0

通过 DTE 的 COM 自动化如下所示:

/// Intel convertion 
Project proj;
proj = DTE.Solution.Projects.Item(1) // Should be vc++ one

ProjectConversions pconv = (ProjectConversions)EnvDTE.GetObject("PrjConvert");
pconv.EnableUsingIntelCppCompiler(prj1.Name);

您只需从 /Common7\IDE\PublicAssemblies 添加 .NET 参考 IntelCppOptPkg.dll

此外,还有一个转换工具,位于“\Common Files\Intel\shared files\ia32\Bin\ICProjConvert.exe”。有关可用键 /? 的工具的帮助信息 或通过网址

几乎所有你需要的东西都可以在MSDN 自动化文档中找到

于 2011-10-17T10:52:54.927 回答