lazbuild: fixed overriding cpu, os, lclwidgetset

git-svn-id: trunk@9841 -
This commit is contained in:
mattias 2006-09-08 16:16:42 +00:00
parent 3e7b2a440d
commit b47221ff92
4 changed files with 38 additions and 38 deletions

View File

@ -53,6 +53,7 @@ type
TBuildManager = class(TBaseBuildManager)
private
CurrentParsedCompilerOption: TParsedCompilerOptions;
FScanningCompilerDisabled: boolean;
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
const UnparsedValue: string;
PlatformIndependent: boolean): string;
@ -104,6 +105,7 @@ type
destructor Destroy; override;
procedure SetupTransferMacros;
procedure SetupCompilerInterface;
procedure SetupInputHistories;
function GetTargetOS(UseCache: boolean): string; override;
function GetTargetCPU(UseCache: boolean): string; override;
@ -120,6 +122,8 @@ type
procedure GetFPCCompilerParamsForEnvironmentTest(out Params: string);
procedure RescanCompilerDefines(OnlyIfCompilerChanged: boolean);
property ScanningCompilerDisabled: boolean read FScanningCompilerDisabled
write FScanningCompilerDisabled;
function CheckAmbiguousSources(const AFilename: string;
Compiling: boolean): TModalResult; override;
@ -186,7 +190,8 @@ end;
destructor TBuildManager.Destroy;
begin
OnBackupFileInteractive:=nil;
FreeAndNil(InputHistories);
inherited Destroy;
MainBuildBoss:=nil;
end;
@ -250,6 +255,16 @@ begin
end;
end;
procedure TBuildManager.SetupInputHistories;
begin
if InputHistories<>nil then exit;
InputHistories:=TInputHistories.Create;
with InputHistories do begin
SetLazarusDefaultFilename;
Load;
end;
end;
function TBuildManager.GetTargetOS(UseCache: boolean): string;
begin
if UseCache then ;
@ -423,12 +438,13 @@ var
UnitLinksValid: boolean;
i: Integer;
function SearchSystemInUnitLinks: boolean;
function FoundSystemPPU: boolean;
begin
Result:=System.Pos('system ',CompilerUnitLinks)>0;
end;
begin
if ScanningCompilerDisabled then exit;
GetFPCCompilerParamsForEnvironmentTest(CurOptions);
{$IFDEF VerboseFPCSrcScan}
writeln('TMainIDE.RescanCompilerDefines A ',CurOptions,
@ -450,6 +466,7 @@ begin
{$IFDEF VerboseFPCSrcScan}
debugln('TMainIDE.RescanCompilerDefines B rebuilding FPC templates CurOptions="',CurOptions,'"');
{$ENDIF}
SetupInputHistories;
CompilerTemplate:=CodeToolBoss.DefinePool.CreateFPCTemplate(
EnvironmentOptions.CompilerFilename,CurOptions,
CreateCompilerTestPascalFilename,CompilerUnitSearchPath,
@ -480,7 +497,7 @@ begin
CompilerUnitLinks:='';
if UnitLinksValid then
CompilerUnitLinks:=InputHistories.FPCConfigCache.GetUnitLinks(CurOptions);
if not SearchSystemInUnitLinks then begin
if not FoundSystemPPU then begin
UnitLinksValid:=false;
end;
@ -493,7 +510,7 @@ begin
{$IFDEF VerboseFPCSrcScan}
debugln('TMainIDE.RescanCompilerDefines C UnitLinks=',copy(CompilerUnitLinks,1,100));
{$ENDIF}
if not SearchSystemInUnitLinks then begin
if not FoundSystemPPU then begin
IDEMessageDialog('Error',
'The system.ppu was not found in the FPC directories. '
+'Make sure fpc is installed correctly and the fpc.cfg points to the right directory.',

View File

@ -283,7 +283,7 @@ const
);
var
InputHistories: TInputHistories;
InputHistories: TInputHistories = nil;
implementation

View File

@ -426,22 +426,6 @@ begin
if Project1.MainUnitInfo=nil then
Error(ErrorBuildFailed,'project has no main unit');
if WidgetSetOverride <> '' then begin
//WriteLn('Overriding TargetWS=',WidgetSetOverride);
Project1.CompilerOptions.LCLWidgetType := WidgetSetOverride;
Project1.DefineTemplates.UpdateGlobalValues;
end;
if OSOverride <> '' then begin
//WriteLn('Overriding TargetOS=',OSOverride);
Project1.CompilerOptions.TargetOS := OSOverride;
end;
if CPUOverride <> '' then begin
//WriteLn('Overriding TargetCPU=',CPUOverride);
Project1.CompilerOptions.TargetCPU := CPUOverride;
end;
if not SkipDependencies then begin
// compile required packages
CheckPackageGraphForCompilation(nil,Project1.FirstRequiredDependency);
@ -564,6 +548,7 @@ begin
CreatePrimaryConfigPath;
MainBuildBoss:=TBuildManager.Create;
MainBuildBoss.ScanningCompilerDisabled:=true;
LoadEnvironmentOptions;
InteractiveSetup:=false;
SetupCompilerFilename(InteractiveSetup);
@ -576,6 +561,8 @@ begin
// create static base packages
PackageGraph.AddStaticBasePackages;
MainBuildBoss.SetBuildTarget(OSOverride,CPUOverride,WidgetSetOverride);
fInitResult:=true;
end;
@ -699,7 +686,7 @@ begin
If FindLongopt(O) then
begin
If HaveArg then
//Result:=Format(lisErrNoOptionAllowed,[I,O]) // stops all longoptions with args from working
Result:=Format(lisErrNoOptionAllowed,[I,O]) // stops all longoptions with args from working
end
else
begin // Required argument
@ -765,6 +752,7 @@ end;
constructor TLazBuildApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
SetupDialogs;
TOutputFilterProcess:=TProcess;
Files:=TStringList.Create;
end;
@ -826,19 +814,19 @@ begin
NonOptions:=TStringList.Create;
LongOptions:=TStringList.Create;
try
LongOptions.Add('primary-config-path');
LongOptions.Add('pcp');
LongOptions.Add('secondary-config-path');
LongOptions.Add('scp');
LongOptions.Add('language');
LongOptions.Add('primary-config-path:');
LongOptions.Add('pcp:');
LongOptions.Add('secondary-config-path:');
LongOptions.Add('scp:');
LongOptions.Add('language:');
LongOptions.Add('build-all');
LongOptions.Add('recursive');
LongOptions.Add('skip-dependencies');
LongOptions.Add('widgetset');
LongOptions.Add('ws');
LongOptions.Add('operating-system');
LongOptions.Add('os');
LongOptions.Add('cpu');
LongOptions.Add('widgetset:');
LongOptions.Add('ws:');
LongOptions.Add('operating-system:');
LongOptions.Add('os:');
LongOptions.Add('cpu:');
ErrorMsg:=RepairedCheckOptions('lBrd',LongOptions,Options,NonOptions);
if ErrorMsg<>'' then begin
writeln(ErrorMsg);

View File

@ -1015,11 +1015,7 @@ begin
Load;
end;
InputHistories:=TInputHistories.Create;
with InputHistories do begin
SetLazarusDefaultFilename;
Load;
end;
MainBuildBoss.SetupInputHistories;
CreateDir(GetProjectSessionsConfigPath);
end;
@ -1175,7 +1171,6 @@ begin
FreeThenNil(MiscellaneousOptions);
FreeThenNil(EditorOpts);
FreeThenNil(EnvironmentOptions);
FreeThenNil(InputHistories);
FreeThenNil(IDECommandScopes);
DebugLn('[TMainIDE.Destroy] B -> inherited Destroy... ',ClassName);