LazBuild: Allow passing additional compilation options. Issue #37827.

This commit is contained in:
n7800 2024-09-28 01:50:29 +05:00 committed by Juha
parent 4a3a87c2ac
commit ad85d36b04
2 changed files with 13 additions and 0 deletions

View File

@ -172,6 +172,7 @@ resourcestring
'info file after build. If not specified, build number will be incremented '+
'if configured.';
lisExtraOpts = 'Pass additional options to the compiler';
lisGetExpandText = 'Print the result of substituting macros in the text. '+
'The absence of macros in the text means the name of the macro. '+
'By default, active build mode is used.';

View File

@ -471,6 +471,7 @@ function TLazBuildApplication.BuildPackage(const AFilename: string): boolean;
var
APackage: TLazPackage;
Flags: TPkgCompileFlags;
S: String;
begin
Result:=false;
@ -498,6 +499,9 @@ begin
APackage.CompilerOptions.TargetCPU:=CPUOverride;
if SubtargetOverride then
APackage.CompilerOptions.Subtarget:=SubtargetOverrideValue;
if HasLongOptIgnoreCase('opt', S) then
with APackage.CompilerOptions do
CustomOptions := MergeCustomOptions(CustomOptions, S);
if CreateMakefile then
DoCreateMakefile(APackage)
@ -807,6 +811,10 @@ var
MatrixOption.MacroName:='LCLWidgetType';
MatrixOption.Value:=WidgetSetOverride;
end;
if HasLongOptIgnoreCase('opt', S) then
with Project1.CompilerOptions do
CustomOptions := MergeCustomOptions(CustomOptions, S);
// apply options
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
@ -1583,6 +1591,7 @@ begin
LongOptions.Add('subtarget:');
LongOptions.Add('bm:');
LongOptions.Add('build-mode:');
LongOptions.Add('opt:');
LongOptions.Add('compiler:');
LongOptions.Add('lazarusdir:');
LongOptions.Add('create-makefile');
@ -1820,6 +1829,9 @@ begin
writeln('--bm=<project/IDE build mode>, --build-mode=<project/IDE build mode>');
w(lisOverrideTheProjectBuildMode);
writeln('');
writeln('--opt=<extra-options>');
w(lisExtraOpts);
writeln('');
writeln('--compiler=<ppcXXX>');
w(lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD);
writeln('');