且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从命令行构建多个 CDT C++ 项目

更新时间:2023-11-28 12:55:28

此功能已添加到 CDT 6(最终版本于 2009 年 6 月 15 日到期)中.您可以从构建页面下载最终候选版本:download.eclipse.org/tools/cdt/builds/6.0.0/.

This feature has been added in CDT 6 (Final build due June 15th 2009). You can download the final release candidate from builds page: download.eclipse.org/tools/cdt/builds/6.0.0/.

使用 Eclipse 3.5 + CDT 6 的发行版,您可以使用在命令行发送到 Eclipse 的以下选项导入、构建和清理构建项目和工作区:

Using a release of Eclipse 3.5 + CDT 6, you can import, build and clean-build projects and the workspace using the following options sent to Eclipse at the command line:

eclipse -nosplash 
        -application org.eclipse.cdt.managedbuilder.core.headlessbuild 
        -import {[uri:/]/path/to/project} 
        -build {project_name | all} 
        -cleanBuild {projec_name | all}

在 Windows 上,使用 eclipsec.exe 而不是 eclipse.exe 将构建输出写入 stdout/stderr,以便调用阻塞直到完成.

On Windows, use eclipsec.exe instead of eclipse.exe to have build output written to stdout/stderr and so that the call blocks until completion.

-application"开关指示 Eclipse 运行 CDT 无头构建器,而不是启动工作台.其他开关可以单独使用或一起使用.这意味着您可以使用自己的 shell 脚本检出项目,将其-import"到工作区,然后使用 Managedbuilder 的无头构建器-build"它.

The '-application' switch instructs Eclipse to run the CDT headless builder rather than starting the workbench. The other switches can be used individually or together. This means you can checkout a project using a shell script of your own, '-import' it into a workspace, and '-build' it using the Managedbuilder's headless builder.

使用'-data'开关指定要使用的工作空间,可以是一个空的临时目录,平台运行时支持的其他开关请参见运行时文档:help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html

Use the '-data' switch to specify the workspace to use, which can be an empty temporary directory, see the runtime documentation for other switches supported by the platform runtime: help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html

请参阅 bug 186847 评论 24 及更多详细信息关于已提交的功能.

See bug 186847 comment 24 and onwards for more detail on the committed functionality.