Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile a delphi application through command line (silent mode) which uses third party components?

Tags:

delphi

I have a delphi application which uses multiple 3rd party components like DevExpress, TeeChart, etc.. I want to compile this (to make a automatic build) through command line. How can I achieve this?

Expecting a Delphi application to compile/build via command prompt.

Thanks in advance.

like image 443
RajKumar Sivanantham Avatar asked Oct 21 '25 00:10

RajKumar Sivanantham


1 Answers

I'm not sure how it can be done in Delphi 7, but in recent versions of Delphi it's easy.

  1. You must prepare Project Group with all that you need to compile
  2. Make BAT file that will compile this project group by msbuild
  3. Call this BAT when you need to compile.

Detail's of making BAT file:

First of all you need to have all necessary environment variables in context of BAT file. Standard Delphi environment variables stored in "rsvars.bat"-file in Delphi directory
(for Delphi 11 it's "c:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat")
So, to have it in your context just use BAT-command:

call "c:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat"

if you need to specify some other environment variables witches need to be specified to compile your packages or projects, you can do it in a same way as it done in rsvars.bat

After that step - msbuild can find Delphi compiler to run building. So, you can just call:

msbuild ".\MyProjectGroup.groupproj"

That all you need to compile projects with default params.

Sure, you can customize compiler params, so my command line looks like:

msbuild ".\MyProjectGroup.groupproj"  /t:%BuildMode% /l:FileLogger,Microsoft.Build.Engine;logfile=MyProjectGroup_%PlatformMode%_%ConfigMode%.log;verbosity=quiet /p:Config=%ConfigMode% /p:platform=%PlatformMode%

where:
%BuildMode% - can be Build, Clean, Make
%ConfigMode% - Debug or Release
%PlatformMode% - Win32 or Win64

For more information look at official Doc

P.S. Last version of Delphi Community Edition does not support command line compiling.

like image 135
Oleksandr Morozevych Avatar answered Oct 25 '25 07:10

Oleksandr Morozevych