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.
I'm not sure how it can be done in Delphi 7, but in recent versions of Delphi it's easy.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With