mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 06:00:07 +02:00
IDE: build IDE: use default compiler, not compiler of project
git-svn-id: trunk@44333 -
This commit is contained in:
parent
45e9bd0b9c
commit
d0d17505d9
@ -61,6 +61,7 @@ type
|
|||||||
|
|
||||||
TBuildManager = class(TBaseBuildManager)
|
TBuildManager = class(TBaseBuildManager)
|
||||||
private
|
private
|
||||||
|
FBuildTarget: TObject;
|
||||||
FUnitSetCache: TFPCUnitSetCache;
|
FUnitSetCache: TFPCUnitSetCache;
|
||||||
fBuildLazExtraOptions: string; // last build lazarus extra options
|
fBuildLazExtraOptions: string; // last build lazarus extra options
|
||||||
FUnitSetChangeStamp: integer;
|
FUnitSetChangeStamp: integer;
|
||||||
@ -147,6 +148,7 @@ type
|
|||||||
function OnRunCompilerWithOptions(ExtTool: TIDEExternalToolOptions;
|
function OnRunCompilerWithOptions(ExtTool: TIDEExternalToolOptions;
|
||||||
CompOptions: TBaseCompilerOptions): TModalResult;
|
CompOptions: TBaseCompilerOptions): TModalResult;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
procedure OnProjectDestroy(Sender: TObject);
|
||||||
procedure SetUnitSetCache(const AValue: TFPCUnitSetCache);
|
procedure SetUnitSetCache(const AValue: TFPCUnitSetCache);
|
||||||
protected
|
protected
|
||||||
// command line overrides
|
// command line overrides
|
||||||
@ -229,6 +231,7 @@ type
|
|||||||
function BuildTargetIDEIsDefault: boolean;
|
function BuildTargetIDEIsDefault: boolean;
|
||||||
|
|
||||||
property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
|
property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
|
||||||
|
property BuildTarget: TObject read FBuildTarget; // TProject or nil
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -267,6 +270,15 @@ end;
|
|||||||
|
|
||||||
{ TBuildManager }
|
{ TBuildManager }
|
||||||
|
|
||||||
|
procedure TBuildManager.OnProjectDestroy(Sender: TObject);
|
||||||
|
var
|
||||||
|
aProject: TProject;
|
||||||
|
begin
|
||||||
|
aProject:=TProject(Sender);
|
||||||
|
if FBuildTarget=aProject then
|
||||||
|
FBuildTarget:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBuildManager.OnMacroSubstitution(TheMacro: TTransferMacro;
|
procedure TBuildManager.OnMacroSubstitution(TheMacro: TTransferMacro;
|
||||||
const MacroName: string; var s: string; const Data: PtrInt; var Handled,
|
const MacroName: string; var s: string; const Data: PtrInt; var Handled,
|
||||||
Abort: boolean; Depth: integer);
|
Abort: boolean; Depth: integer);
|
||||||
@ -598,14 +610,18 @@ end;
|
|||||||
function TBuildManager.GetFPCompilerFilename: string;
|
function TBuildManager.GetFPCompilerFilename: string;
|
||||||
var
|
var
|
||||||
s: string;
|
s: string;
|
||||||
|
AProject: TProject;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
if (Project1<>nil)
|
if (FBuildTarget is TProject) then
|
||||||
and ([crCompile,crBuild]*Project1.CompilerOptions.CompileReasons<>[])
|
begin
|
||||||
and (Project1.CompilerOptions.CompilerPath<>'')
|
AProject:=TProject(FBuildTarget);
|
||||||
then begin
|
if ([crCompile,crBuild]*AProject.CompilerOptions.CompileReasons<>[])
|
||||||
Result:=Project1.GetCompilerFilename;
|
and (AProject.CompilerOptions.CompilerPath<>'')
|
||||||
//debugln(['TBuildManager.GetFPCompilerFilename project compiler="',Result,'"']);
|
then begin
|
||||||
|
Result:=AProject.GetCompilerFilename;
|
||||||
|
//debugln(['TBuildManager.GetFPCompilerFilename project compiler="',Result,'"']);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if not IsFPCExecutable(Result,s) then begin
|
if not IsFPCExecutable(Result,s) then begin
|
||||||
//if Result<>'' then debugln(['TBuildManager.GetFPCompilerFilename project compiler NOT fpc: "',Result,'"']);
|
//if Result<>'' then debugln(['TBuildManager.GetFPCompilerFilename project compiler NOT fpc: "',Result,'"']);
|
||||||
@ -2573,8 +2589,8 @@ begin
|
|||||||
// compute new TargetOS
|
// compute new TargetOS
|
||||||
if OverrideTargetOS<>'' then
|
if OverrideTargetOS<>'' then
|
||||||
fTargetOS:=OverrideTargetOS
|
fTargetOS:=OverrideTargetOS
|
||||||
else if Project1<>nil then
|
else if FBuildTarget is TProject then
|
||||||
fTargetOS:=Project1.CompilerOptions.TargetOS
|
fTargetOS:=TProject(FBuildTarget).CompilerOptions.TargetOS
|
||||||
else
|
else
|
||||||
fTargetOS:='';
|
fTargetOS:='';
|
||||||
if (fTargetOS='') or (SysUtils.CompareText(fTargetOS,'default')=0) then
|
if (fTargetOS='') or (SysUtils.CompareText(fTargetOS,'default')=0) then
|
||||||
@ -2584,8 +2600,8 @@ begin
|
|||||||
// compute new TargetCPU
|
// compute new TargetCPU
|
||||||
if OverrideTargetCPU<>'' then
|
if OverrideTargetCPU<>'' then
|
||||||
fTargetCPU:=OverrideTargetCPU
|
fTargetCPU:=OverrideTargetCPU
|
||||||
else if Project1<>nil then
|
else if FBuildTarget is TProject then
|
||||||
fTargetCPU:=Project1.CompilerOptions.TargetCPU
|
fTargetCPU:=TProject(FBuildTarget).CompilerOptions.TargetCPU
|
||||||
else
|
else
|
||||||
fTargetCPU:='';
|
fTargetCPU:='';
|
||||||
if (fTargetCPU='') or (SysUtils.CompareText(fTargetCPU,'default')=0) then
|
if (fTargetCPU='') or (SysUtils.CompareText(fTargetCPU,'default')=0) then
|
||||||
@ -2616,6 +2632,9 @@ end;
|
|||||||
procedure TBuildManager.SetBuildTargetProject1(Quiet: boolean;
|
procedure TBuildManager.SetBuildTargetProject1(Quiet: boolean;
|
||||||
ScanFPCSrc: TScanModeFPCSources);
|
ScanFPCSrc: TScanModeFPCSources);
|
||||||
begin
|
begin
|
||||||
|
FBuildTarget:=Project1;
|
||||||
|
if FBuildTarget<>nil then
|
||||||
|
TProject(FBuildTarget).AddHandlerDestroy(@OnProjectDestroy);
|
||||||
SetBuildTarget('','','',ScanFPCSrc,Quiet);
|
SetBuildTarget('','','',ScanFPCSrc,Quiet);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2625,6 +2644,7 @@ var
|
|||||||
NewTargetCPU: String;
|
NewTargetCPU: String;
|
||||||
NewLCLWidgetSet: String;
|
NewLCLWidgetSet: String;
|
||||||
begin
|
begin
|
||||||
|
FBuildTarget:=nil;
|
||||||
with MiscellaneousOptions do begin
|
with MiscellaneousOptions do begin
|
||||||
NewTargetOS:=BuildLazOpts.TargetOS;
|
NewTargetOS:=BuildLazOpts.TargetOS;
|
||||||
NewTargetCPU:=BuildLazOpts.TargetCPU;
|
NewTargetCPU:=BuildLazOpts.TargetCPU;
|
||||||
|
Loading…
Reference in New Issue
Block a user