[Lazarus] Compiling LCL units via commandline

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jul 25 16:56:49 CEST 2012


On Wed, 25 Jul 2012 16:23:38 +0200
Reinier Olislagers <reinierolislagers at gmail.com> wrote:

>[...]
> > I guess a simply flag is not sufficient. See the many verbosity flags
> > in the IDE. They were all added on users demand.
> True. First user demand for lazbuild though :)

Well, not really the first. ;)

 
> Perhaps we could just pass on -v (and --verbose=) flags to fpc unless no
> -v flags specified and then use current behaviour?

Note: The fpc.cfg normally contains -v flags too.

> Then we can use -v0 (show nothing except errors) to make lazbuild quieter.
> 
> >> Also, it may be possible to adapt lazbuild to be able to compile your
> >> example program (and similar programs) without need for creating an .lpi
> >> or .lpr file.
> > 
> > Some people suggests to use compiler and IDE directives in the lpr
> > file, which the IDE and lazbuild can use if no lpi is present.
> Mmm yes, if we do that we could also move all lpi data into the lpr anyway?

Mixing human edited content and auto generated
content is asking for trouble.
The session data should never be stored in the source.

 
> Have just created a simple console project (see below).
> I suppose lazbuild could perhaps use code from the IDE to create a new
> blank Program type project, change ProjectOptions & CompilerOptions
> PathDelim, Title, Unit0 Filename and UnitName, and then save it with the
> same filename as the .pas file but with .lpi extension, and build it as
> usual.
> 
> Of course, we're in trouble if we specify non-res resources or do more
> complicated stuff.
> 
> Perhaps something like this is best left to a wrapper program?
> 
> <?xml version="1.0"?>
> <CONFIG>
>   <ProjectOptions>
>     <Version Value="9"/>
>     <PathDelim Value="\"/>
>     <General>
>       <Flags>
>         <MainUnitHasCreateFormStatements Value="False"/>
>         <MainUnitHasTitleStatement Value="False"/>
>       </Flags>
>       <SessionStorage Value="InProjectDir"/>
>       <MainUnit Value="0"/>
>       <Title Value="project1"/>
>       <UseAppBundle Value="False"/>
>       <ResourceType Value="res"/>
>     </General>
>     <i18n>
>       <EnableI18N LFM="False"/>
>     </i18n>
>     <VersionInfo>
>       <StringTable ProductVersion=""/>
>     </VersionInfo>
>     <BuildModes Count="1">
>       <Item1 Name="Default" Default="True"/>
>     </BuildModes>
>     <PublishOptions>
>       <Version Value="2"/>
>       <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
>       <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
>     </PublishOptions>
>     <RunParams>
>       <local>
>         <FormatVersion Value="1"/>
>       </local>
>     </RunParams>
>     <Units Count="1">
>       <Unit0>
>         <Filename Value="project1.lpr"/>
>         <IsPartOfProject Value="True"/>
>         <UnitName Value="project1"/>
>       </Unit0>
>     </Units>
>   </ProjectOptions>
>   <CompilerOptions>
>     <Version Value="11"/>
>     <PathDelim Value="\"/>
>     <SearchPaths>
>       <IncludeFiles Value="$(ProjOutDir)"/>
>     </SearchPaths>
>     <Other>
>       <CompilerMessages>
>         <UseMsgFile Value="True"/>
>       </CompilerMessages>
>       <CompilerPath Value="$(CompPath)"/>
>     </Other>
>   </CompilerOptions>
>   <Debugging>
>     <Exceptions Count="3">
>       <Item1>
>         <Name Value="EAbort"/>
>       </Item1>
>       <Item2>
>         <Name Value="ECodetoolError"/>
>       </Item2>
>       <Item3>
>         <Name Value="EFOpenError"/>
>       </Item3>
>     </Exceptions>
>   </Debugging>
> </CONFIG>

Hmm, need some clean up.

Mattias




More information about the Lazarus mailing list