mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:38:14 +02:00
IDE: compare default target os, cpu with compiler default
git-svn-id: trunk@42063 -
This commit is contained in:
parent
eb4f930af7
commit
4c88931c65
@ -750,6 +750,8 @@ type
|
||||
property ChangeStamp: integer read FChangeStamp;
|
||||
function Find(CompilerFilename, CompilerOptions, TargetOS, TargetCPU: string;
|
||||
CreateIfNotExists: boolean): TFPCTargetConfigCache;
|
||||
procedure GetDefaultCompilerTarget(const CompilerFilename,CompilerOptions: string;
|
||||
out TargetOS, TargetCPU: string);
|
||||
function GetListing: string;
|
||||
end;
|
||||
|
||||
@ -7489,6 +7491,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFPCTargetConfigCaches.GetDefaultCompilerTarget(
|
||||
const CompilerFilename, CompilerOptions: string; out TargetOS,
|
||||
TargetCPU: string);
|
||||
var
|
||||
Cfg: TFPCTargetConfigCache;
|
||||
begin
|
||||
Cfg:=Find(CompilerFilename,CompilerOptions,'','',true);
|
||||
if Cfg=nil then begin
|
||||
TargetOS:='';
|
||||
TargetCPU:='';
|
||||
end else begin
|
||||
TargetOS:=Cfg.RealTargetOS;
|
||||
TargetCPU:=Cfg.RealTargetCPU;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFPCTargetConfigCaches.GetListing: string;
|
||||
var
|
||||
Node: TAVLTreeNode;
|
||||
|
@ -27,7 +27,8 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FPCAdds, Forms, Controls, Graphics, Dialogs, LResources,
|
||||
LCLProc, StdCtrls, Buttons, LazConf, LazarusIDEStrConsts, ExtCtrls, ComCtrls,
|
||||
EnvironmentOpts, Clipbrd, FileUtil, lazutf8classes, Menus, LCLIntf;
|
||||
EnvironmentOpts, Clipbrd, FileUtil, lazutf8classes, DefineTemplates, Menus,
|
||||
LCLIntf;
|
||||
|
||||
type
|
||||
|
||||
@ -161,7 +162,7 @@ begin
|
||||
RevisionLabel.Caption := lisSVNRevision+LazarusRevisionStr;
|
||||
BuildDateLabel.Caption := lisDate+': '+GetLocalizedBuildDate;
|
||||
FPCVersionLabel.Caption:= lisFPCVersion+{$I %FPCVERSION%};
|
||||
PlatformLabel.Caption:=GetDefaultTargetCPU+'-'+GetDefaultTargetOS
|
||||
PlatformLabel.Caption:=GetCompiledTargetCPU+'-'+GetCompiledTargetOS
|
||||
+'-'+LCLPlatformDisplayNames[GetDefaultLCLWidgetType];
|
||||
|
||||
VersionPage.Caption:=lisVersion;
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
Classes, SysUtils, LCLProc, LConvEncoding, Forms, Controls, LCLType, LCLIntf,
|
||||
Graphics, GraphType, StdCtrls, ExtCtrls, Buttons, FileUtil, LazUTF8,
|
||||
LazLogger, lazutf8classes, Dialogs, InterfaceBase, Themes, CheckLst, Menus,
|
||||
ComCtrls, DividerBevel, DefineTemplates,
|
||||
ComCtrls, DividerBevel, DefineTemplates, CodeToolManager,
|
||||
// IDEIntf
|
||||
LazIDEIntf, IDEMsgIntf, IDEHelpIntf, IDEImagesIntf, IDEWindowIntf, IDEDialogs,
|
||||
PackageIntf,
|
||||
@ -327,10 +327,10 @@ begin
|
||||
CmdLineParams:=' -w';
|
||||
// append target OS
|
||||
if Profile.TargetOS<>'' then
|
||||
CmdLineParams+=' OS_TARGET='+Profile.FPCTargetOS;
|
||||
CmdLineParams+=' OS_TARGET='+Profile.FPCTargetOS+' OS_SOURCE='+Profile.FPCTargetOS;
|
||||
// append target CPU
|
||||
if Profile.TargetCPU<>'' then
|
||||
CmdLineParams+=' CPU_TARGET='+Profile.FPCTargetCPU;
|
||||
CmdLineParams+=' CPU_TARGET='+Profile.FPCTargetCPU+' CPU_SOURCE='+Profile.FPCTargetCPU;
|
||||
|
||||
Tool.ScanOutputForFPCMessages:=true;
|
||||
Tool.ScanOutputForMakeMessages:=true;
|
||||
@ -567,8 +567,12 @@ begin
|
||||
TargetFilename:='';
|
||||
UnitOutDir:='';
|
||||
TargetDirectory:='';
|
||||
DefaultTargetOS:=GetDefaultTargetOS;
|
||||
DefaultTargetCPU:=GetDefaultTargetCPU;
|
||||
CodeToolBoss.FPCDefinesCache.ConfigCaches.GetDefaultCompilerTarget(
|
||||
EnvironmentOptions.GetParsedCompilerFilename,'',DefaultTargetOS,DefaultTargetCPU);
|
||||
if DefaultTargetOS='' then
|
||||
DefaultTargetOS:=GetCompiledTargetOS;
|
||||
if DefaultTargetCPU='' then
|
||||
DefaultTargetCPU:=GetCompiledTargetCPU;
|
||||
TargetOS:=Profile.FPCTargetOS;
|
||||
TargetCPU:=Profile.FPCTargetCPU;
|
||||
TargetLCLPlatform:=LCLPlatformDirNames[Profile.TargetPlatform];
|
||||
|
@ -297,8 +297,8 @@ begin
|
||||
FFPCVerChangeStamp:=CTInvalidChangeStamp;
|
||||
MainBuildBoss:=Self;
|
||||
inherited Create(AOwner);
|
||||
fTargetOS:=GetDefaultTargetOS;
|
||||
fTargetCPU:=GetDefaultTargetCPU;
|
||||
fTargetOS:=GetCompiledTargetOS;
|
||||
fTargetCPU:=GetCompiledTargetCPU;
|
||||
fLCLWidgetType:=LCLPlatformDirNames[GetDefaultLCLWidgetType];
|
||||
FUnitSetChangeStamp:=TFPCUnitSetCache.GetInvalidChangeStamp;
|
||||
|
||||
@ -2186,7 +2186,7 @@ function TBuildManager.OnGetBuildMacroValues(Options: TBaseCompilerOptions;
|
||||
if Project1<>nil then
|
||||
s:=Project1.CompilerOptions.TargetOS;
|
||||
if s='' then
|
||||
s:=GetDefaultTargetOS;
|
||||
s:=GetCompiledTargetOS;
|
||||
Values.Values['TargetOS']:=s;
|
||||
end;
|
||||
// SrcOS
|
||||
@ -2205,7 +2205,7 @@ function TBuildManager.OnGetBuildMacroValues(Options: TBaseCompilerOptions;
|
||||
if Project1<>nil then
|
||||
s:=Project1.CompilerOptions.TargetCPU;
|
||||
if s='' then
|
||||
s:=GetDefaultTargetCPU;
|
||||
s:=GetCompiledTargetCPU;
|
||||
Values.Values['TargetCPU']:=s;
|
||||
end;
|
||||
end;
|
||||
@ -2418,7 +2418,7 @@ begin
|
||||
else
|
||||
fTargetOS:='';
|
||||
if (fTargetOS='') or (SysUtils.CompareText(fTargetOS,'default')=0) then
|
||||
fTargetOS:=GetDefaultTargetOS;
|
||||
fTargetOS:=GetCompiledTargetOS;
|
||||
fTargetOS:=GetFPCTargetOS(fTargetOS);
|
||||
|
||||
// compute new TargetCPU
|
||||
@ -2429,7 +2429,7 @@ begin
|
||||
else
|
||||
fTargetCPU:='';
|
||||
if (fTargetCPU='') or (SysUtils.CompareText(fTargetCPU,'default')=0) then
|
||||
fTargetCPU:=GetDefaultTargetCPU;
|
||||
fTargetCPU:=GetCompiledTargetCPU;
|
||||
fTargetCPU:=GetFPCTargetCPU(fTargetCPU);
|
||||
|
||||
FPCTargetChanged:=(OldTargetOS<>fTargetOS)
|
||||
@ -2471,9 +2471,9 @@ begin
|
||||
NewLCLWidgetSet:=LCLPlatformDirNames[BuildLazOpts.TargetPlatform];
|
||||
end;
|
||||
if (NewTargetOS='') or (NewTargetOS='default') then
|
||||
NewTargetOS:=GetDefaultTargetOS;
|
||||
NewTargetOS:=GetCompiledTargetOS;
|
||||
if (NewTargetCPU='') or (NewTargetCPU='default') then
|
||||
NewTargetCPU:=GetDefaultTargetCPU;
|
||||
NewTargetCPU:=GetCompiledTargetCPU;
|
||||
if ConsoleVerbosity>=0 then
|
||||
debugln(['TBuildManager.SetBuildTargetIDE OS=',NewTargetOS,' CPU=',NewTargetCPU,' WS=',NewLCLWidgetSet]);
|
||||
SetBuildTarget(NewTargetOS,NewTargetCPU,NewLCLWidgetSet,smsfsBackground,false);
|
||||
@ -2491,8 +2491,8 @@ begin
|
||||
NewLCLWidgetSet:=BuildLazOpts.TargetPlatform;
|
||||
end;
|
||||
//debugln(['TBuildManager.BuildTargetIDEIsDefault NewTargetOS=',NewTargetOS,' Default=',GetDefaultTargetOS,' NewTargetCPU=',NewTargetCPU,' default=',GetDefaultTargetCPU,' ws=',LCLPlatformDisplayNames[NewLCLWidgetSet],' default=',LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]);
|
||||
Result:=((NewTargetOS='') or (NewTargetOS=GetDefaultTargetOS))
|
||||
and ((NewTargetCPU='') or (NewTargetCPU=GetDefaultTargetCPU))
|
||||
Result:=((NewTargetOS='') or (NewTargetOS=GetCompiledTargetOS))
|
||||
and ((NewTargetCPU='') or (NewTargetCPU=GetCompiledTargetCPU))
|
||||
and (NewLCLWidgetSet<>lpNoGUI);
|
||||
end;
|
||||
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
IDEOptionsIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, IDEProcs, IDEMsgIntf, LazConf, TransferMacros,
|
||||
ModeMatrixOpts, CompOptsModes;
|
||||
ModeMatrixOpts, CompOptsModes, EnvironmentOpts;
|
||||
|
||||
type
|
||||
|
||||
@ -1855,7 +1855,7 @@ function TBaseCompilerOptions.CreateTargetFilename(
|
||||
PathName := ExtractFilePath(Result);
|
||||
//debugln ( 'Filename is ',FileName, ' in PrependDefaultType' );
|
||||
CurTargetOS:=TargetOS;
|
||||
if CurTargetOS='' then CurTargetOS:=GetDefaultTargetOS;
|
||||
if CurTargetOS='' then CurTargetOS:=GetCompiledTargetOS;
|
||||
aSrcOS:=GetDefaultSrcOSForTargetOS(CurTargetOS);
|
||||
if (CompareText(aSrcOS, 'unix') = 0)
|
||||
then begin
|
||||
@ -2411,6 +2411,9 @@ var
|
||||
CurTargetCPU: String;
|
||||
CurSrcOS: String;
|
||||
dit: TCompilerDbgSymbolType;
|
||||
CompilerFilename: String;
|
||||
DefaultTargetOS: string;
|
||||
DefaultTargetCPU: string;
|
||||
begin
|
||||
CurMainSrcFile:=MainSourceFileName;
|
||||
if CurMainSrcFile='' then
|
||||
@ -2760,13 +2763,17 @@ begin
|
||||
//if (VariablesInRegisters) then
|
||||
// Switches := Switches + ' -OoREGVAR';
|
||||
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
CodeToolBoss.FPCDefinesCache.ConfigCaches.GetDefaultCompilerTarget(
|
||||
CompilerFilename,'',DefaultTargetOS,DefaultTargetCPU);
|
||||
|
||||
{ Target OS }
|
||||
if (CurTargetOS<>'')
|
||||
and ((TargetOS<>'') or (CurTargetOS<>GetDefaultTargetOS)) then
|
||||
and ((TargetOS<>'') or (CurTargetOS<>DefaultTargetOS)) then
|
||||
switches := switches + ' -T' + CurTargetOS;
|
||||
{ Target CPU }
|
||||
if (CurTargetCPU<>'')
|
||||
and ((TargetCPU<>'') or (CurTargetCPU<>GetDefaultTargetCPU)) then
|
||||
and ((TargetCPU<>'') or (CurTargetCPU<>DefaultTargetCPU)) then
|
||||
switches := switches + ' -P' + CurTargetCPU;
|
||||
{ TargetProcessor }
|
||||
if TargetProcessor<>'' then
|
||||
|
@ -22,6 +22,13 @@
|
||||
|
||||
Abstract:
|
||||
Find all alternative declarations of an identifier.
|
||||
|
||||
TCarbonControl = class(TCarbonWidget)
|
||||
procedure TCarbonControl.CreateWidget(const AParams: TCreateParams);
|
||||
TCarbonCustomCheckBox = class(TCarbonControl)
|
||||
TCarbonCheckBox = class(TCarbonCustomCheckBox)
|
||||
procedure TCarbonCheckBox.CreateWidget(const AParams: TCreateParams);
|
||||
|
||||
}
|
||||
unit FindOverloadsDlg;
|
||||
|
||||
|
@ -141,17 +141,15 @@ var
|
||||
WorkDir: String;
|
||||
fs: TFileStreamUTF8;
|
||||
begin
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
CompilerOptions:='';
|
||||
Cfg:=CodeToolBoss.FPCDefinesCache.ConfigCaches.Find(
|
||||
CompilerFilename,CompilerOptions,TargetOS,TargetCPU,true);
|
||||
sl:=TStringList.Create;
|
||||
List:=nil;
|
||||
try
|
||||
// fpc -i
|
||||
sl.Add('The IDE asks the compiler with the following command for the real OS/CPU:');
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
CompilerOptions:='';
|
||||
Cfg:=CodeToolBoss.FPCDefinesCache.ConfigCaches.Find(
|
||||
CompilerFilename,CompilerOptions,'','',true);
|
||||
// fpc -i
|
||||
ExtraOptions:=Cfg.GetFPCInfoCmdLineOptions(CodeToolBoss.FPCDefinesCache.ExtraOptions);
|
||||
Params:=Trim('-iTOTP '+ExtraOptions);
|
||||
WorkDir:=GetCurrentDirUTF8;
|
||||
@ -168,6 +166,10 @@ begin
|
||||
sl.Add('');
|
||||
|
||||
// fpc -va
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
Cfg:=CodeToolBoss.FPCDefinesCache.ConfigCaches.Find(
|
||||
CompilerFilename,CompilerOptions,TargetOS,TargetCPU,true);
|
||||
TestFilename:=CodeToolBoss.FPCDefinesCache.TestFilename;
|
||||
Filename:=ExtractFileName(TestFilename);
|
||||
WorkDir:=ExtractFilePath(TestFilename);
|
||||
|
@ -143,7 +143,7 @@ end;
|
||||
procedure InternalInit;
|
||||
begin
|
||||
DefaultDrive := ExtractFileDrive(ProgramDirectory);
|
||||
DefaultFPCTarget:= GetDefaultTargetCPU + '-' + GetDefaultTargetOS;
|
||||
DefaultFPCTarget:= GetCompiledTargetCPU + '-' + GetCompiledTargetOS;
|
||||
DefaultFPCVersion:= {$I %FPCVERSION%};
|
||||
// the last part of the path returned by GetAppConfigDir is the application
|
||||
// name. Replace that by 'lazarus', to make sure that lazbuild uses
|
||||
|
@ -14,6 +14,9 @@
|
||||
</MacroValues>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
<SharedMatrixOptions Count="1">
|
||||
<Item1 ID="037437114172" Modes="default" Type="IDEMacro" MacroName="LCLWidgetType" Value="nogui"/>
|
||||
</SharedMatrixOptions>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
@ -80,6 +83,5 @@
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
<LCLWidgetType Value="nogui"/>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
||||
|
@ -1563,7 +1563,7 @@ begin
|
||||
writeln('or --os=<operating-system>');
|
||||
writeln(LongToConsole(Format(
|
||||
lisOverrideTheProjectOperatingSystemEGWin32LinuxDefau, [space,
|
||||
LazConf.GetDefaultTargetOS])));
|
||||
GetCompiledTargetOS])));
|
||||
writeln('');
|
||||
writeln('--widgetset=<widgetset>');
|
||||
writeln('or --ws=<widgetset>');
|
||||
@ -1574,7 +1574,7 @@ begin
|
||||
writeln('--cpu=<cpu>');
|
||||
writeln(LongToConsole(Format(
|
||||
lisOverrideTheProjectCpuEGI386X86_64PowerpcPowerpc_64, [space,
|
||||
LazConf.GetDefaultTargetCPU])));
|
||||
GetCompiledTargetCPU])));
|
||||
writeln('');
|
||||
writeln('--build-mode=<project/ide build mode>');
|
||||
writeln('or --bm=<project/ide build mode>');
|
||||
|
@ -100,9 +100,6 @@ procedure GetDefaultMakeFilenames(List: TStrings); // list of standard paths of
|
||||
function GetDefaultFPCSrcDirectories: TStringList;
|
||||
function GetDefaultLazarusSrcDirectories: TStringList;
|
||||
|
||||
function GetDefaultTargetCPU: string;
|
||||
function GetDefaultTargetOS: string;
|
||||
|
||||
// returns the standard executable extension (e.g '.exe')
|
||||
function GetExecutableExt(TargetOS: string = ''): string;
|
||||
function MakeStandardExeFilename(TargetOS, Filename: string): string;
|
||||
@ -371,7 +368,7 @@ end;
|
||||
function GetExecutableExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
if (CompareText(copy(TargetOS,1,3), 'win') = 0)
|
||||
or (CompareText(copy(TargetOS,1,3), 'dos') = 0) then
|
||||
Result:='.exe'
|
||||
@ -385,7 +382,7 @@ var
|
||||
begin
|
||||
Result:=Filename;
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
StdExt:=GetExecutableExt(TargetOS);
|
||||
if StdExt='' then exit;
|
||||
Result:=ChangeFileExt(Result,StdExt);
|
||||
@ -394,7 +391,7 @@ end;
|
||||
function GetLibraryExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
if CompareText(copy(TargetOS,1,3), 'win') = 0 then
|
||||
Result:='.dll'
|
||||
else if CompareText(TargetOS, 'darwin') = 0 then
|
||||
@ -414,7 +411,7 @@ var
|
||||
SrcOS: String;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
Result:='';
|
||||
SrcOS:=GetDefaultSrcOSForTargetOS(TargetOS);
|
||||
if CompareText(SrcOS, 'unix') = 0 then
|
||||
@ -428,7 +425,7 @@ var
|
||||
begin
|
||||
Result:=Filename;
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetDefaultTargetOS;
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
// change extension
|
||||
StdExt:=GetLibraryExt(TargetOS);
|
||||
if StdExt<>'' then
|
||||
@ -446,16 +443,6 @@ begin
|
||||
Result:=ExtractFilePath(Result)+lowercase(ExtractFileName(Result));
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:=lowerCase({$I %FPCTARGETOS%});
|
||||
end;
|
||||
|
||||
function GetDefaultTargetCPU: string;
|
||||
begin
|
||||
Result:=lowerCase({$I %FPCTARGETCPU%});
|
||||
end;
|
||||
|
||||
function GetDefaultCompilerFilename: string;
|
||||
begin
|
||||
Result:=DefineTemplates.GetDefaultCompilerFilename;
|
||||
|
Loading…
Reference in New Issue
Block a user