如何使用 Eclipse/CDT 并行构建项目(不是并行编译!)
我有几个项目都依赖于一个基本库。现在,当我更改这个基本库中的头文件时,我必须重建所有依赖项目。目前,Eclipse/CDT 构建了一个又一个项目。我如何并行构建所有这些项目?
请注意,我已经为每个项目使用了 -j(并行编译)选项。但这还不够,因为:
- 确实有很多 CPU 可用(对于大多数项目来说,比源文件还多),并且
- 由于并行编译,链接比编译花费的时间远并且(据我所知)可以不使用多线程。
I have several projects which all rely on a basic library. Now when I change a header file in this basic library I have to rebuild all dependent projects. Currently Eclipse/CDT builds one project after another. How can I build all these projects in parallel?
Please note that I already use the -j (parallel compiling) option for each project. But this is not enough because:
- there are really a lot of CPU's available (for most projects more than source files) and
- due to parallel compiling the linking takes much longer than compiling and (to my knowledge) can not use multi-threading.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不认为当前版本的 Eclipse CDT 可以并行构建项目,但是您可以通过构建多个二进制文件(库和可执行文件)的 Eclipse CDT Makefile 项目来实现相同的效果。
生成此类项目的一个简单方法是使用 CMake 和 Eclipse CDT4 - Unix Makefile 生成器。然后,如果您指定
/usr/bin/make -j
作为构建命令,其中n
是项目属性中并行作业的数量,它将构建您的并行目标(不仅仅是源文件)。I don't think the current version of Eclipse CDT can build projects in parallel, but you can achieve the same effect by having an Eclipse CDT Makefile project which builds multiple binaries (libraries and executables).
A simple way to generate such project is by using CMake with Eclipse CDT4 - Unix Makefiles generator. Then if you specify
/usr/bin/make -j<n>
as a build command, wheren
is the number of parallel jobs in Project Properties, it will build your targets (not only source files) in parallel.项目属性> C++ 构建 >行为>启用并行构建
Project Properties > C++ Build > Behaviour > Enable Parallel Build