加快构建时间的方法? (C#/非托管 C++)

发布于 2024-07-30 10:43:53 字数 124 浏览 2 评论 0原文

我目前正在开发的一个遗留应用程序需要大约 2 小时才能构建。 该项目大约有 170 个项目,其中 150 个左右是非托管 C++,另外 30 个是 C#.Net 2.0。

对于缩短此类项目的构建时间有哪些建议?

A legacy app I am working on currenty takes ~2hours to build. The project has about 170 projects with 150 or so being unmanaged C++ and the other 30 C#.Net 2.0.

What are some suggestions on ways to improve build times for something like this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

枯叶蝶 2024-08-06 10:43:54

您可以尝试分布式构建系统 Incredibuild:http://www.xoreax.com/visual_studio.htm

You may try the distributed build system Incredibuild: http://www.xoreax.com/visual_studio.htm

背叛残局 2024-08-06 10:43:54

您可以使用 lint 之类的工具来查看您的文件中是否有多余的包含文件c++ 项目。

Games from Within 上还有一篇关于此主题的精彩文章。

You could use a tool like lint to see if you have redundant include files in your c++ projects.

There is also a great article on this subject at Games from Within.

青衫儰鉨ミ守葔 2024-08-06 10:43:54

为项目制定多个解决方案,仅包含项目的相关子集,并为发布等留下一个超级解决方案。

Make multiple solutions for the project that only include relevant subsets of the projects and leave one super solution for releases etc.

壹場煙雨 2024-08-06 10:43:53

专注于 C++ 项目 - 它们几乎肯定是构建过程中最耗时的项目。

有关缩短 C++ 构建时间的一些技巧:

  • 确保仅包含 C++ 项目中所需的标头!
  • 尽可能在标头中使用前向声明,而不是包含其他标头 尽可能
  • 使用 /MP 开关并行构建
  • 有效使用抽象
  • 避免使用内联函数,因为这些函数在编译时的成本更高
  • 正确获取依赖关系,以便您构建的次数并没有超过所需的次数
  • 适当地使用预编译头文件

除此之外,如果您谈论的是 2 小时的构建时间,通常还有一个简单、便宜(从整体上看)的解决方案:

  • 升级您的硬件帮助减少计算时间

Focus on the C++ projects - they are almost guaranteed to be the largest time drains for building.

Some tips on getting the C++ build times down:

  • Make sure that you're only including headers that you need in the C++ projects!
  • Use forward declarations whenever possible in headers instead of including other headers
  • Use the /MP switch to build in parallel, when possible
  • Use abstraction effectively
  • Be sparing in the use of inline functions, since these cost more at compile time
  • Get the dependencies correct, so you're not building more often that required
  • Use pre-compiled headers appropriately

Aside from that, if you're talking 2 hour build times, often there is a simple, cheap (in a big picture way) solution, as well:

  • Upgrade your hardware to help reduce the computation times
你是我的挚爱i 2024-08-06 10:43:53

如果您在需要构建的每台计算机上安装 IncrediBuild,它将在所有计算机之间分配构建过程。
如果您确实想仅使用硬件来解决问题,您可以设置一些仅用作 IncrediBuild 客户端的专用计算机。

在不同的规模上,确保您的每个项目都具有正确配置的预编译标头。

If you install IncrediBuild on every machine that needs to build it, it distributes the build process among all of the machines.
If you really want to just throw hardware at the problem you can set up a few dedicated machines that serve only as IncrediBuild clients.

On a different scale, make sure your every project has pre-compiled headers configured correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文