Delphi Programming
Register
Advertisement

Delphi, in addition to the IDE comes with a commandline compiler called dcc32.exe. It can be used to compile a project without starting the IDE and even in batch mode.

There were two major changes regarding the format of the project files:

  1. Up to Delphi 7 a project consisted of a .dpr, .dof and an automatically created .cfg file
  2. In Delphi 2005 and 2006 a project consisted of a .dpr and a .bdsproj file
  3. Since Delphi 2007 a project consists of a .dpr and a .dproj file

(Note that my memory of the process for before Delphi 2007 is rather sketchy, so if there are any errors, please correct them!)

See also Easily Switching between "Debug" and "Release" Builds

Delphi 1 to 7[]

In these Delphi versions each project consisted of a .dpr file which contained a uses-list of all the project's units and the main program, a .dof file which in .ini file format contained all the project's settings, e.g. the compiler switches and the search paths. In addition the IDE created a .cfg file which contained the settings in a different format, suitable for the commandline compiler.

As long as you are content to just use the same settings as in the IDE you can just call

dcc32 <project>.dpr

and the commandline compiler will compile your project, using the settings from the .cfg file.

If you do not want to rely on the IDE to create the .cfg file, there is this dof2cfg tool

If you are using project groups (.bpg), you could also use the borland make tool because a .bpg file had the format of a make file for this tool. I won't go into more details on this because it could become fairly complex and since this is the year 2009, nobody will want to use that ancient stuff anyway. (If you want to add this description, feel free to do it, though.)

Delphi 2005 and 2006[]

Starting with Delphi 2005 and up to Delphi 2006 (=Turbo Delphi) Borland replaced the .dof file with a .bdsproj file in XML format. If I remember correctly, the IDE still automaticall created a .cfg file so commandline compilation was still as simple as calling

dcc32 <project>.dpr

and the commandline compiler will compile your project, using the settings from the .cfg file.

Note though, that the free TurboDelphi Explorer did not include the commandline compiler. TurboDelphi professional had it as a separate download for registered users.

Similar to Dof2Cfg mentioned above there is Bdsproj2Cfg for creating a .cfg file from the IDEs .bdsproj file.

Delphi 2007 and later[]

In Delphi 2007 Codegear changed the format again, replacing the .bdsproj file with a .dproj file. This was because they started using the Microsoft build (msbuild) tool. A .dproj file is still in XML format but different from the .bdsproj file. It is a make file for msbuild but since msbuild does not know about handling Delphi sources, it needs some additional configuration. Luckily you don't need to do that yourself because Codegear already created a batch file that does it for you. So for compiling a Delphi project, you do this:

call "%ProgramFiles%\CodeGear\RAD Studio\5.0\bin\rsvars.bat"

msbuild <project>.dproj


(This is for Delphi 2007, for later versions, adjust the path to rsvars.bat accordingly.)

--Dummzeuch 13:35, October 11, 2009 (UTC)

To get this to work for Delphi 2007 in 64 bit Windows (7 or 8), you need to copy the following files:

  • Borland.Common.Targets
  • Borland.Cpp.Targets
  • Borland.Delphi.Targets
  • Borland.Group.Targets

from C:\Windows\Microsoft.NET\Framework\v2.0.50727

to

C:\Windows\Microsoft.NET\Framework64\v2.0.50727

(http://qc.embarcadero.com/wc/qcmain.aspx?d=54409)

Advertisement