diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas
index 56cca286f6..23002a349f 100644
--- a/components/codetools/definetemplates.pas
+++ b/components/codetools/definetemplates.pas
@@ -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;
diff --git a/ide/aboutfrm.pas b/ide/aboutfrm.pas
index 4c630927d7..51a1cc4422 100644
--- a/ide/aboutfrm.pas
+++ b/ide/aboutfrm.pas
@@ -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;
diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas
index b1d9b9e8f9..22a7034b68 100644
--- a/ide/buildlazdialog.pas
+++ b/ide/buildlazdialog.pas
@@ -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];
diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas
index 9029da0c7b..78f5a10c90 100644
--- a/ide/buildmanager.pas
+++ b/ide/buildmanager.pas
@@ -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;
diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp
index dc00778014..7c18950fa7 100644
--- a/ide/compileroptions.pp
+++ b/ide/compileroptions.pp
@@ -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
diff --git a/ide/findoverloadsdlg.pas b/ide/findoverloadsdlg.pas
index def9e72f30..1c2044fe86 100644
--- a/ide/findoverloadsdlg.pas
+++ b/ide/findoverloadsdlg.pas
@@ -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;
diff --git a/ide/idefpcinfo.pas b/ide/idefpcinfo.pas
index b8a7e3e322..1826b8873d 100644
--- a/ide/idefpcinfo.pas
+++ b/ide/idefpcinfo.pas
@@ -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);
diff --git a/ide/include/win/lazbaseconf.inc b/ide/include/win/lazbaseconf.inc
index 05e50df6b7..9412d34e62 100644
--- a/ide/include/win/lazbaseconf.inc
+++ b/ide/include/win/lazbaseconf.inc
@@ -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
diff --git a/ide/lazbuild.lpi b/ide/lazbuild.lpi
index a8fb1b3f2c..520eca7b6d 100644
--- a/ide/lazbuild.lpi
+++ b/ide/lazbuild.lpi
@@ -14,6 +14,9 @@
+
+
+
@@ -80,6 +83,5 @@
-
diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr
index 4258ff12db..f616047249 100644
--- a/ide/lazbuild.lpr
+++ b/ide/lazbuild.lpr
@@ -1563,7 +1563,7 @@ begin
writeln('or --os=');
writeln(LongToConsole(Format(
lisOverrideTheProjectOperatingSystemEGWin32LinuxDefau, [space,
- LazConf.GetDefaultTargetOS])));
+ GetCompiledTargetOS])));
writeln('');
writeln('--widgetset=');
writeln('or --ws=');
@@ -1574,7 +1574,7 @@ begin
writeln('--cpu=');
writeln(LongToConsole(Format(
lisOverrideTheProjectCpuEGI386X86_64PowerpcPowerpc_64, [space,
- LazConf.GetDefaultTargetCPU])));
+ GetCompiledTargetCPU])));
writeln('');
writeln('--build-mode=');
writeln('or --bm=');
diff --git a/ide/lazconf.pp b/ide/lazconf.pp
index e4989ee677..1de2417d58 100644
--- a/ide/lazconf.pp
+++ b/ide/lazconf.pp
@@ -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;