lazbuild: added option --build-mode=<project build mode>, --bm=<project build mode>

git-svn-id: trunk@27874 -
This commit is contained in:
mattias 2010-10-26 08:27:21 +00:00
parent 61d35b321a
commit 17d1cba55e
5 changed files with 35 additions and 5 deletions

View File

@ -4604,6 +4604,7 @@ resourcestring
lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD = '%soverride the '
+'default compiler. e.g. ppc386 ppcx64 ppcppc etc. default is stored in '
+'environmentoptions.xml';
lisOverrideTheProjectBuildMode = '%soverride the project build mode.';
lisNo = 'No';
lisProjectChangedOnDisk = 'Project changed on disk';
lisTheProjectInformationFileHasChangedOnDisk = 'The project information '

View File

@ -9,6 +9,9 @@
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
</General>
<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)"/>

View File

@ -46,6 +46,7 @@ type
FBuildAll: boolean;
FBuildIDE: boolean;
FBuildIDEOptions: string;
FBuildModeOverride: String;
FBuildRecursive: boolean;
fCompilerOverride: String;
fLazarusDirOverride : String;
@ -135,6 +136,7 @@ type
property CPUOverride: String read fCPUOverride write fCPUOverride;
property CompilerOverride: String read fCompilerOverride write fCompilerOverride;
property LazarusDirOverride: String read fLazarusDirOverride write fLazarusDirOverride;
property BuildModeOverride: String read FBuildModeOverride write FBuildModeOverride;
end;
var
@ -598,6 +600,7 @@ var
UnitOutputDirectory: String;
TargetExeName: String;
TargetExeDir: String;
NewBuildMode: TProjectBuildMode;
begin
Result:=false;
CloseProject(Project1);
@ -609,12 +612,21 @@ begin
if Project1.MainUnitInfo=nil then
Error(ErrorBuildFailed,'project has no main unit');
if (Length(OSOverride) <> 0) then
// first override build mode
if (BuildModeOverride<>'') then begin
NewBuildMode:=Project1.BuildModes.Find(BuildModeOverride);
if NewBuildMode=nil then
Error(ErrorBuildFailed,'invalid build mode '+BuildModeOverride);
Project1.ActiveBuildMode:=NewBuildMode;
end;
// then override specific options
if (OSOverride<>'') then
Project1.CompilerOptions.TargetOS:=OSOverride;
if (Length(CPUOverride) <> 0) then
if (CPUOverride<>'') then
Project1.CompilerOptions.TargetCPU:=CPUOverride;
if (Length(WidgetSetOverride) <> 0) then
if (WidgetSetOverride<>'') then
Project1.CompilerOptions.LCLWidgetType:=WidgetSetOverride;
// apply options
MainBuildBoss.SetBuildTarget(Project1.CompilerOptions.TargetOS,
Project1.CompilerOptions.TargetCPU,Project1.CompilerOptions.LCLWidgetType);
@ -1080,6 +1092,8 @@ begin
LongOptions.Add('operating-system:');
LongOptions.Add('os:');
LongOptions.Add('cpu:');
LongOptions.Add('bm:');
LongOptions.Add('build-mode:');
LongOptions.Add('compiler:');
LongOptions.Add('lazarusdir:');
ErrorMsg:=RepairedCheckOptions('lBrd',LongOptions,Options,NonOptions);
@ -1139,7 +1153,13 @@ begin
// cpu
if HasOption('cpu') then
CPUOverride := GetOptionValue('cpu');
// build mode
if HasOption('bm') then
BuildModeOverride := GetOptionValue('bm')
else if HasOption('build-mode') then
BuildModeOverride := GetOptionValue('build-mode');
// compiler
if HasOption('compiler') then
CompilerOverride := GetOptionValue('compiler');
@ -1203,6 +1223,11 @@ begin
LazConf.GetDefaultTargetCPU]),
75, 22)));
writeln('');
writeln('--build-mode=<project build mode>');
writeln('or --bm=<project build mode>');
writeln(UTF8ToConsole(BreakString(Format(lisOverrideTheProjectBuildMode,
[space]), 75, 22)));
writeln('');
writeln('--compiler=<ppcXXX>');
writeln(UTF8ToConsole(BreakString(Format(
lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD, [space]),

View File

@ -3332,7 +3332,6 @@ begin
if NewMode=Project1.ActiveBuildMode then exit;
Project1.ActiveBuildMode:=NewMode;
IncreaseBuildMacroChangeStamp;
MainBuildBoss.SetBuildTarget(Project1.CompilerOptions.TargetOS,
Project1.CompilerOptions.TargetCPU,Project1.CompilerOptions.LCLWidgetType);
end;

View File

@ -5113,6 +5113,8 @@ begin
FMacroValues:=nil;
end;
SessionModified:=true;
if Self=Project1 then
IncreaseBuildMacroChangeStamp;
end;
procedure TProject.SetAutoOpenDesignerFormsDisabled(const AValue: boolean);