diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 8955bea095..95f5f556f0 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -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.', diff --git a/ide/inputhistory.pas b/ide/inputhistory.pas index 5133fadeca..8453497d37 100644 --- a/ide/inputhistory.pas +++ b/ide/inputhistory.pas @@ -283,7 +283,7 @@ const ); var - InputHistories: TInputHistories; + InputHistories: TInputHistories = nil; implementation diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index b8ce3f1f2f..256e660a76 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -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); diff --git a/ide/main.pp b/ide/main.pp index 04e76320bd..5f6d685cfb 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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);