Profiling with CMake, C++, and Visual Studio 2012

白昼怎懂夜的黑 提交于 2019-12-09 06:04:32

问题


I am using CMake 2.8.10.1 to generate project files for Visual Studio 2012 Ultimate (64-bit). The resulting solution contains a library, some tests, and some executables.

I would like to profile some of the applications. When I select "ANALYZE" -> "Start Performance Analysis," I encounter the error message "No launchable projects are available for profiling." How can I profile my solution generated by CMake?


回答1:


It seems I've found a way to fix it. You need to add win32 configuration under your project. Then profiler will see your project as launchable. For example, for the release configuration you should add the following

<ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
</ProjectConfiguration> 

under

<ItemGroup Label="ProjectConfigurations">

Using the menu:

  • Build -> Configuration Manager
  • Goto row of the project to profile
  • In the platform column note that it will only have a x64 entry
  • Use dropdown <New...> and select Win32 for New platform:
  • -



回答2:


That's a ridiculous bug in Visual Studio. QMake also suffers from this.

https://connect.microsoft.com/VisualStudio/feedback/details/823467/performance-wizard-doesnt-show-any-projects-to-profile-if-there-is-no-win32-configuration



来源:https://stackoverflow.com/questions/13934895/profiling-with-cmake-c-and-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!