如何自动转换 Visual Studio 项目以使用 Intel C++编译器。
我们正在使用英特尔 C++ 编译器来提高 C++ 代码的性能。为了使用它,我们需要通过IDE将我们的Visual Studio项目转换为intel项目。由于英特尔编译器并非随处安装,因此我们仅在需要创建英特尔版本的机器上执行此步骤。
我们想探索一种通过某些脚本自动执行此转换过程的方法。我们想知道是否可以使用 EnvDTE API 来做同样的事情。
到目前为止,我们已经能够在 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
此时我们可以调用这样的函数:
sol.Clean
sol.Build
并且它们运行良好。
除此之外,我们无法找到一种方法来识别可应用于解决方案的其他命令。例如,英特尔 C++ 编译器将其自身作为插件集成到 Visual Studio 中。我们想知道是否可以找出一种方法来识别解决方案对象可用的命令列表,然后执行适当的命令将 Visual Studio 项目转换为使用英特尔编译器。
是否可以自动执行此转换?
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了那些可能遇到同样问题的人的利益 - 您可以使用 DTE.ExecuteCommand 运行任意命令,包括扩展公开的命令。要打印所有可用命令的列表,您可以运行以下 VBScript:
In the interests of those who might stumble into the same - you can use DTE.ExecuteCommand to run arbitrary commands, including those exposed by extensions. To print out a list of all available commands, you can run this VBScript:
通过 DTE 的 COM 自动化如下所示:
您只需从 /Common7\IDE\PublicAssemblies 添加 .NET 引用 IntelCppOptPkg.dll
另外,还有一个转换工具,位于“\Common Files\Intel\shared files\ia32\Bin” \ICProjConvert.exe”。
有关可用键 /? 提供的工具的帮助信息或通过 URL
几乎您需要的所有内容都可以在 MSDN 自动化文档
COM automation via DTE looks as follows:
You just need to add .NET reference IntelCppOptPkg.dll from /Common7\IDE\PublicAssemblies
Additionally, There is a conversion tool, which located at "\Common Files\Intel\shared files\ia32\Bin\ICProjConvert.exe".
A help info about the tool available with key /? or by the URL
Almost everything you need you can find in MSDN automation documentation