在命令行编译C ++ Builder项目 [英] Compiling C++Builder project on command line

查看:287
本文介绍了在命令行编译C ++ Builder项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法来编译 C ++ Builder的项目(具体从命令行生成配置)?

是这样的:

  CommandToBuild ProjectNameToBuild BuildConfiguration ...


解决方案

有自动化您的构建C ++ Builder中(如我的经验,我在谈论旧的C ++ Builder的版本像<一个不同的方法HREF =htt​​ps://en.wikipedia.org/wiki/C++Builder#Version_history相对=nofollow> 5和6 )。

您可以手动调用编译器 - bcc32.exe (也是 dcc32.exe BRCC32.EXE tasm32.exe 如果你需要编译的德尔福单位,资源文件或在你的源代码code的汇编语言线)和链接 - ilink32.exe

在这种情况下,您将需要手动提供必要的输入文件,路径和密钥作为编译和链接的每个阶段的论点。

必需的编译和链接的所有数据都存储在项目文件,并希望能有专门的实用工具,包括在C ++ Builder安装,它可以自动完成这一肮脏的工作,到编译器和链接器提供必要的参数和运行它们。他们的名字是 bpr2mak.exe 的make.exe

首先,你必须运行 bpr2mak.exe ,传递您的项目* .bpr或* .bpk文件作为参数,然后你会得到一个特殊的* .MAK文件作为输出,您可以使用在的make.exe 饲料,并最终将建立您的项目。

看这个简单的CMD脚本:

  @ bpr2mak.exe YourProject.bpr
@ren YourProject.mak的makefile
@的make.exe

您可以提供的YourProject.mak的真名作为参数传递给的make.exe ,但最简单的方法是将* .MAK文件重命名为Makefile文件,然后的make.exe 会发现它。

要具有不同的编译选项,你可以做到以下几点:

第一种方法:你可以在IDE中,编辑选项打开你的项目,并在同一文件夹不同的项目名称保存(通常有调试两个项目文件和发布编译选项)。然后,您可以提供您的建筑脚本不同的* .bpr文件。这样一来,它看起来很简单,因为它不涉及脚本,但用户必须手动维护所有项目文件的一致性,如果事情的变化(增加表格或单位等)。

第二种方法是做一个脚本,编辑项目文件或进行文件。您将要解析的文件,找到编译器和链接相关线路,并投入所需的密钥。你可以做到这一点即使在CMD脚本,但肯定是一个专门的脚本语言,如的Python 为preferable。

Is there a way to compile a C++Builder project (a specific build configuration) from the command line?

Something like:

CommandToBuild ProjectNameToBuild BuildConfiguration ...

解决方案

There are different ways for automating your builds in C++Builder (as of my experience, I'm speaking about old C++Builder versions like 5 and 6).

You can manually call compilers - bcc32.exe (also dcc32.exe, brcc32.exe and tasm32.exe if you have to compile Delphi units, resource files or assembly language lines of code in your sources) and linker - ilink32.exe.

In this case, you will need to manually provide the necessary input files, paths, and keys as arguments for each stage of compilation and linking.

All data necessary for compilation and linking is stored in project files and, hopefully there are special utilities, included in the C++Builder installation, which can automate this dirty work, provide necessary parameters to compilers and linker and run them. Their names are bpr2mak.exe and make.exe.

First you have to run bpr2mak.exe, passing your project *.bpr or *.bpk file as a parameter and then you will get a special *.mak file as output, which you can use to feed on make.exe, which finally will build your project.

Look at this simple cmd script:

@bpr2mak.exe YourProject.bpr
@ren YourProject.mak makefile
@make.exe

You can provide the real name of "YourProject.mak" as a parameter to make.exe, but the most straightforward way is to rename the *.mak file to "makefile", and then make.exe will find it.

To have different build options, you can do the following:

The first way: you can open your project in the IDE, edit options and save it with a different project name in the same folder (usually there are two project files for debug and release compile options). Then you can provide your building script with different *.bpr files. This way, it looks simple, because it doesn't involves scripting, but the user will have to manually maintain coherency of all project files if something changes (forms or units added and so on).

The second way is to make a script which edits the project file or make file. You will have to parse files, find compiler and linker related lines and put in the necessary keys. You can do it even in a cmd script, but surely a specialised scripting language like Python is preferable.

这篇关于在命令行编译C ++ Builder项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆