mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:39:18 +02:00
ide+codetools: added fpc subtarget to caches
This commit is contained in:
parent
52586f02ec
commit
977c3d1383
@ -153,6 +153,7 @@ type
|
||||
private
|
||||
FOnModified: TNotifyEvent;
|
||||
fOwner: TObject;
|
||||
FSubTarget: string;
|
||||
SetEmulatedFloatOpcodes: boolean;
|
||||
function GetDebugInfoTypeStr: String;
|
||||
procedure SetAllowLabel(const AValue: Boolean);
|
||||
@ -195,6 +196,7 @@ type
|
||||
procedure SetSmartLinkUnit(const AValue: Boolean);
|
||||
procedure SetStackChecks(const AValue: Boolean);
|
||||
procedure SetStackSize(const AValue: Integer);
|
||||
procedure SetSubTarget(AValue: string);
|
||||
procedure SetTypedAddress(const AValue: Boolean);
|
||||
procedure SetStopAfterErrCount(const AValue: integer);
|
||||
procedure SetStripSymbols(const AValue: Boolean);
|
||||
@ -416,6 +418,7 @@ type
|
||||
property TargetOS: string read fTargetOS write SetTargetOS;
|
||||
property TargetCPU: string read fTargetCPU write SetTargetCPU; // general type
|
||||
property TargetProcessor: String read fTargetProc write SetTargetProc; // specific
|
||||
property SubTarget: string read FSubTarget write SetSubTarget;
|
||||
property OptimizationLevel: Integer read fOptLevel write SetOptLevel;
|
||||
property VariablesInRegisters: Boolean read fVarsInReg write SetVarsInReg;
|
||||
property UncertainOptimizations: Boolean read fUncertainOpt write SetUncertainOpt;
|
||||
@ -824,6 +827,13 @@ begin
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
procedure TLazCompilerOptions.SetSubTarget(AValue: string);
|
||||
begin
|
||||
if FSubTarget=AValue then Exit;
|
||||
FSubTarget:=AValue;
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
procedure TLazCompilerOptions.SetIncludeAssertionCode(const AValue: Boolean);
|
||||
begin
|
||||
if fIncludeAssertionCode=AValue then exit;
|
||||
|
@ -1172,7 +1172,7 @@ begin
|
||||
CompilerDefinesCache.TestFilename:=GetTempFilename('fpctest.pas','');
|
||||
|
||||
UnitSetCache:=CompilerDefinesCache.FindUnitSet(Config.FPCPath,
|
||||
Config.TargetOS,Config.TargetProcessor,Config.FPCOptions,Config.FPCSrcDir,
|
||||
Config.TargetOS,Config.TargetProcessor,Config.SubTarget,Config.FPCOptions,Config.FPCSrcDir,
|
||||
true);
|
||||
// parse compiler settings, fpc sources
|
||||
UnitSetCache.Init;
|
||||
|
@ -94,6 +94,7 @@ type
|
||||
FPPUExt: string;
|
||||
FProjectDir: string;
|
||||
FSourceCaches: TFPCSourceCaches;
|
||||
FSubTarget: string;
|
||||
FTargetOS: string;
|
||||
FTargetProcessor: string;
|
||||
FTestPascalFile: string;
|
||||
@ -106,6 +107,7 @@ type
|
||||
procedure SetModified(const AValue: boolean);
|
||||
procedure SetPPUExt(const AValue: string);
|
||||
procedure SetProjectDir(const AValue: string);
|
||||
procedure SetSubTarget(AValue: string);
|
||||
procedure SetTargetOS(const AValue: string);
|
||||
procedure SetTargetProcessor(const AValue: string);
|
||||
procedure SetTestPascalFile(const AValue: string);
|
||||
@ -128,6 +130,7 @@ type
|
||||
property FPCOptions: string read FFPCOptions write SetFPCOptions; // extra options for fpc
|
||||
property TargetOS: string read FTargetOS write SetTargetOS;
|
||||
property TargetProcessor: string read FTargetProcessor write SetTargetProcessor;
|
||||
property SubTarget: string read FSubTarget write SetSubTarget;
|
||||
property TestPascalFile: string read FTestPascalFile write SetTestPascalFile; // points to an empty unit
|
||||
property PPUExt: string read FPPUExt write SetPPUExt;
|
||||
property SourceCaches: TFPCSourceCaches read FSourceCaches;
|
||||
@ -217,6 +220,13 @@ begin
|
||||
Modified:=true;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsOptions.SetSubTarget(AValue: string);
|
||||
begin
|
||||
if FSubTarget=AValue then Exit;
|
||||
FSubTarget:=AValue;
|
||||
Modified:=true;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsOptions.SetTargetOS(const AValue: string);
|
||||
begin
|
||||
if FTargetOS=AValue then exit;
|
||||
@ -276,6 +286,8 @@ begin
|
||||
TargetOS:=GetEnvironmentVariableUTF8('FPCTARGET');
|
||||
if GetEnvironmentVariableUTF8('FPCTARGETCPU')<>'' then
|
||||
TargetProcessor:=GetEnvironmentVariableUTF8('FPCTARGETCPU');
|
||||
if GetEnvironmentVariableUTF8('FPCSUBTARGET')<>'' then
|
||||
SubTarget:=GetEnvironmentVariableUTF8('FPCSUBTARGET');
|
||||
end;
|
||||
|
||||
function TCodeToolsOptions.FindDefaultCompilerFilename: string;
|
||||
@ -292,6 +304,7 @@ begin
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/SrcDir/Value',FPCSrcDir,'');
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/TargetOS/Value',TargetOS,'');
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/TargetProcessor/Value',TargetProcessor,'');
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/SubTarget/Value',SubTarget,'');
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/PPUExt/Value',PPUExt,'.ppu');
|
||||
XMLConfig.SetDeleteValue(Path+'FPC/TestPascalFile/Value',TestPascalFile,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Lazarus/SrcDir/Value',LazarusSrcDir,'');
|
||||
@ -311,6 +324,7 @@ begin
|
||||
FPCSrcDir:=XMLConfig.GetValue(Path+'FPC/SrcDir/Value','');
|
||||
TargetOS:=XMLConfig.GetValue(Path+'FPC/TargetOS/Value','');
|
||||
TargetProcessor:=XMLConfig.GetValue(Path+'FPC/TargetProcessor/Value','');
|
||||
SubTarget:=XMLConfig.GetValue(Path+'FPC/SubTarget/Value','');
|
||||
PPUExt:=XMLConfig.GetValue(Path+'FPC/PPUExt/Value','.ppu');
|
||||
TestPascalFile:=XMLConfig.GetValue(Path+'FPC/TestPascalFile/Value','');
|
||||
FConfigCaches.LoadFromXMLConfig(XMLConfig,Path+'FPCConfigCaches/');
|
||||
|
@ -837,6 +837,7 @@ type
|
||||
// key
|
||||
TargetOS: string; // will be passed lowercase
|
||||
TargetCPU: string; // will be passed lowercase
|
||||
SubTarget: string; // will be passed lowercase
|
||||
Compiler: string; // full file name
|
||||
CompilerOptions: string; // e.g. -V<version> -Xp<path>
|
||||
// values
|
||||
@ -907,8 +908,12 @@ type
|
||||
procedure SaveToFile(Filename: string);
|
||||
procedure IncreaseChangeStamp;
|
||||
property ChangeStamp: integer read FChangeStamp;
|
||||
function Find(CompilerFilename: string;
|
||||
CreateIfNotExists: boolean): TPCTargetConfigCache;
|
||||
function Find(CompilerFilename, CompilerOptions, TargetOS, TargetCPU: string;
|
||||
CreateIfNotExists: boolean): TPCTargetConfigCache;
|
||||
function Find(CompilerFilename, CompilerOptions, TargetOS, TargetCPU, SubTarget: string;
|
||||
CreateIfNotExists: boolean): TPCTargetConfigCache;
|
||||
procedure GetDefaultCompilerTarget(const CompilerFilename,CompilerOptions: string;
|
||||
out TargetOS, TargetCPU: string);
|
||||
function GetListing: string;
|
||||
@ -984,22 +989,24 @@ type
|
||||
FChangeStamp: integer;
|
||||
FCompilerFilename: string;
|
||||
FCompilerOptions: string;
|
||||
FFPCSourceDirectory: string;
|
||||
FTargetCPU: string;
|
||||
FTargetOS: string;
|
||||
FConfigCache: TPCTargetConfigCache;
|
||||
fFlags: TFPCUnitToSrcCacheFlags;
|
||||
FFPCSourceDirectory: string;
|
||||
fRulesStampOfConfig: integer; // fSourceCache.ChangeStamp while creation of fFPCSourceRules
|
||||
fSourceCache: TFPCSourceCache;
|
||||
fSourceRules: TFPCSourceRules;
|
||||
fRulesStampOfConfig: integer; // fSourceCache.ChangeStamp while creation of fFPCSourceRules
|
||||
fUnitToSourceTree: TStringToStringTree; // unit name to file name (maybe relative)
|
||||
fUnitStampOfFPC: integer; // FConfigCache.ChangeStamp at creation of fUnitToSourceTree
|
||||
fUnitStampOfFiles: integer; // fSourceCache.ChangeStamp at creation of fUnitToSourceTree
|
||||
fUnitStampOfRules: integer; // fSourceRules.ChangeStamp at creation of fUnitToSourceTree
|
||||
fSrcDuplicates: TStringToStringTree; // unit to list of files (semicolon separated)
|
||||
fFlags: TFPCUnitToSrcCacheFlags;
|
||||
FSubTarget: string;
|
||||
FTargetCPU: string;
|
||||
FTargetOS: string;
|
||||
fUnitStampOfFiles: integer; // fSourceCache.ChangeStamp at creation of fUnitToSourceTree
|
||||
fUnitStampOfFPC: integer; // FConfigCache.ChangeStamp at creation of fUnitToSourceTree
|
||||
fUnitStampOfRules: integer; // fSourceRules.ChangeStamp at creation of fUnitToSourceTree
|
||||
fUnitToSourceTree: TStringToStringTree; // unit name to file name (maybe relative)
|
||||
procedure SetCompilerFilename(const AValue: string);
|
||||
procedure SetCompilerOptions(const AValue: string);
|
||||
procedure SetFPCSourceDirectory(const AValue: string);
|
||||
procedure SetSubTarget(AValue: string);
|
||||
procedure SetTargetCPU(const AValue: string);
|
||||
procedure SetTargetOS(const AValue: string);
|
||||
procedure ClearConfigCache;
|
||||
@ -1017,6 +1024,7 @@ type
|
||||
property CompilerOptions: string read FCompilerOptions write SetCompilerOptions;
|
||||
property TargetOS: string read FTargetOS write SetTargetOS; // case insensitive, will be passed lowercase
|
||||
property TargetCPU: string read FTargetCPU write SetTargetCPU; // case insensitive, will be passed lowercase
|
||||
property SubTarget: string read FSubTarget write SetSubTarget; // case insensitive, will be passed lowercase
|
||||
property FPCSourceDirectory: string read FFPCSourceDirectory write SetFPCSourceDirectory;
|
||||
function GetConfigCache(AutoUpdate: boolean): TPCTargetConfigCache;
|
||||
function GetSourceCache(AutoUpdate: boolean): TFPCSourceCache;
|
||||
@ -1070,15 +1078,15 @@ type
|
||||
function GetPCVersion(const CompilerFilename, TargetOS, TargetCPU: string;
|
||||
UseCompiledVersionAsDefault: boolean;
|
||||
out Kind: TPascalCompiler): string;
|
||||
function FindUnitSet(const CompilerFilename, TargetOS, TargetCPU,
|
||||
function FindUnitSet(const CompilerFilename, TargetOS, TargetCPU, SubTarget,
|
||||
Options, FPCSrcDir: string;
|
||||
CreateIfNotExists: boolean): TFPCUnitSetCache;
|
||||
function FindUnitSetWithID(const UnitSetID: string; out Changed: boolean;
|
||||
CreateIfNotExists: boolean): TFPCUnitSetCache;
|
||||
function GetUnitSetID(CompilerFilename, TargetOS, TargetCPU, Options,
|
||||
function GetUnitSetID(CompilerFilename, TargetOS, TargetCPU, SubTarget, Options,
|
||||
FPCSrcDir: string; ChangeStamp: integer): string;
|
||||
procedure ParseUnitSetID(const ID: string; out CompilerFilename,
|
||||
TargetOS, TargetCPU, Options, FPCSrcDir: string;
|
||||
TargetOS, TargetCPU, SubTarget, Options, FPCSrcDir: string;
|
||||
out ChangeStamp: integer);
|
||||
end;
|
||||
|
||||
@ -1098,6 +1106,7 @@ function GetDefaultCompilerFilename(const TargetCPU: string = ''; Cross: boolean
|
||||
procedure GetTargetProcessors(const TargetCPU: string; aList: TStrings);
|
||||
function GetFPCTargetOS(TargetOS: string): string; // normalize
|
||||
function GetFPCTargetCPU(TargetCPU: string): string; // normalize
|
||||
function GetFPCSubTarget(SubTarget: string): string; // normalize
|
||||
function IsPas2jsTargetOS(TargetOS: string): boolean;
|
||||
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
|
||||
|
||||
@ -3578,9 +3587,11 @@ var
|
||||
Item1: TPCTargetConfigCache absolute CacheItem1;
|
||||
Item2: TPCTargetConfigCache absolute CacheItem2;
|
||||
begin
|
||||
Result:=CompareStr(Item1.TargetOS,Item2.TargetOS);
|
||||
Result:=CompareText(Item1.TargetOS,Item2.TargetOS);
|
||||
if Result<>0 then exit;
|
||||
Result:=CompareStr(Item1.TargetCPU,Item2.TargetCPU);
|
||||
Result:=CompareText(Item1.TargetCPU,Item2.TargetCPU);
|
||||
if Result<>0 then exit;
|
||||
Result:=CompareText(Item1.SubTarget,Item2.SubTarget);
|
||||
if Result<>0 then exit;
|
||||
Result:=CompareFilenames(Item1.Compiler,Item2.Compiler);
|
||||
if Result<>0 then exit;
|
||||
@ -3939,6 +3950,11 @@ begin
|
||||
Result:=LowerCase(TargetCPU);
|
||||
end;
|
||||
|
||||
function GetFPCSubTarget(SubTarget: string): string;
|
||||
begin
|
||||
Result:=LowerCase(SubTarget);
|
||||
end;
|
||||
|
||||
function IsPas2jsTargetOS(TargetOS: string): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
@ -9748,8 +9764,9 @@ var
|
||||
begin
|
||||
Result:=false;
|
||||
if CompareKey then begin
|
||||
if (TargetOS<>Item.TargetOS)
|
||||
or (TargetCPU<>Item.TargetCPU)
|
||||
if (not SameText(TargetOS,Item.TargetOS))
|
||||
or (not SameText(TargetCPU,Item.TargetCPU))
|
||||
or (not SameText(SubTarget,Item.SubTarget))
|
||||
or (Compiler<>Item.Compiler)
|
||||
or (CompilerOptions<>Item.CompilerOptions)
|
||||
then
|
||||
@ -9845,6 +9862,7 @@ begin
|
||||
// keys
|
||||
TargetOS:=Item.TargetOS;
|
||||
TargetCPU:=Item.TargetCPU;
|
||||
SubTarget:=Item.SubTarget;
|
||||
Compiler:=Item.Compiler;
|
||||
CompilerOptions:=Item.CompilerOptions;
|
||||
// values
|
||||
@ -9996,6 +10014,7 @@ begin
|
||||
Kind:=StrToPascalCompiler(XMLConfig.GetValue(Path+'Kind',PascalCompilerNames[pcFPC]));
|
||||
TargetOS:=XMLConfig.GetValue(Path+'TargetOS','');
|
||||
TargetCPU:=XMLConfig.GetValue(Path+'TargetCPU','');
|
||||
SubTarget:=XMLConfig.GetValue(Path+'SubTarget','');
|
||||
Compiler:=XMLConfig.GetValue(Path+'Compiler/File','');
|
||||
CompilerOptions:=XMLConfig.GetValue(Path+'Compiler/Options','');
|
||||
CompilerDate:=XMLConfig.GetValue(Path+'Compiler/Date',0);
|
||||
@ -10181,6 +10200,7 @@ begin
|
||||
XMLConfig.SetDeleteValue(Path+'Kind',PascalCompilerNames[Kind],PascalCompilerNames[pcFPC]);
|
||||
XMLConfig.SetDeleteValue(Path+'TargetOS',TargetOS,'');
|
||||
XMLConfig.SetDeleteValue(Path+'TargetCPU',TargetCPU,'');
|
||||
XMLConfig.SetDeleteValue(Path+'SubTarget',SubTarget,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Compiler/File',Compiler,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Compiler/Options',CompilerOptions,'');
|
||||
XMLConfig.SetDeleteValue(Path+'Compiler/Date',CompilerDate,0);
|
||||
@ -10295,6 +10315,13 @@ begin
|
||||
end;
|
||||
|
||||
function TPCTargetConfigCache.NeedsUpdate: boolean;
|
||||
|
||||
procedure DebugMissing(const Msg: string);
|
||||
begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" SubTarget="',SubTarget,'" Options="',CompilerOptions,'" ',Msg]);
|
||||
end;
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
Cfg: TPCConfigFileState;
|
||||
@ -10303,21 +10330,18 @@ begin
|
||||
Result:=true;
|
||||
|
||||
if (not FileExistsCached(Compiler)) then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" compiler file missing "',Compiler,'"']);
|
||||
DebugMissing('compiler file missing "'+Compiler+'"');
|
||||
exit;
|
||||
end;
|
||||
if (FileAgeCached(Compiler)<>CompilerDate) then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" compiler file changed "',Compiler,'" FileAge=',FileAgeCached(Compiler),' StoredAge=',CompilerDate]);
|
||||
DebugMissing('compiler file changed "'+Compiler+'" FileAge='+dbgs(FileAgeCached(Compiler))+' StoredAge='+dbgs(CompilerDate));
|
||||
exit;
|
||||
end;
|
||||
if (RealCompiler<>'') and (CompareFilenames(RealCompiler,Compiler)<>0)
|
||||
then begin
|
||||
if (not FileExistsCached(RealCompiler))
|
||||
or (FileAgeCached(RealCompiler)<>RealCompilerDate) then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" real compiler file changed "',RealCompiler,'"']);
|
||||
DebugMissing('real compiler file changed "'+RealCompiler+'"');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -10325,21 +10349,18 @@ begin
|
||||
// and that is the RealCompiler
|
||||
AFilename:=FindDefaultTargetCPUCompiler(TargetCPU,true);
|
||||
if RealTargetCPUCompiler<>AFilename then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" real compiler in PATH changed from "',RealTargetCPUCompiler,'" to "',AFilename,'"']);
|
||||
DebugMissing('real compiler in PATH changed from "'+RealTargetCPUCompiler+'" to "'+AFilename+'"');
|
||||
exit;
|
||||
end;
|
||||
for i:=0 to ConfigFiles.Count-1 do begin
|
||||
Cfg:=ConfigFiles[i];
|
||||
if (Cfg.Filename='') or (not FilenameIsAbsolute(Cfg.Filename)) then continue;
|
||||
if FileExistsCached(Cfg.Filename)<>Cfg.FileExists then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" config fileexists changed "',Cfg.Filename,'"']);
|
||||
DebugMissing('config fileexists changed "'+Cfg.Filename+'"');
|
||||
exit;
|
||||
end;
|
||||
if Cfg.FileExists and (FileAgeCached(Cfg.Filename)<>Cfg.FileDate) then begin
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',CompilerOptions,'" config file changed "',Cfg.Filename,'"']);
|
||||
DebugMissing('config file changed "'+Cfg.Filename+'"');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -10354,6 +10375,8 @@ begin
|
||||
Result:=Result+' -P'+LowerCase(TargetCPU);
|
||||
if TargetOS<>'' then
|
||||
Result:=Result+' -T'+LowerCase(TargetOS);
|
||||
if SubTarget<>'' then
|
||||
Result:=Result+' -t'+LowerCase(SubTarget);
|
||||
if ExtraOptions<>'' then
|
||||
Result:=Result+' '+ExtraOptions;
|
||||
Result:=Trim(Result);
|
||||
@ -10399,11 +10422,11 @@ begin
|
||||
Clear;
|
||||
|
||||
if CTConsoleVerbosity>0 then
|
||||
debugln(['Hint: [TPCTargetConfigCache.NeedsUpdate] ',Compiler,' TargetOS=',TargetOS,' TargetCPU=',TargetCPU,' CompilerOptions=',CompilerOptions,' ExtraOptions=',ExtraOptions,' PATH=',GetEnvironmentVariableUTF8('PATH')]);
|
||||
debugln(['Hint: [TPCTargetConfigCache.Update] ',Compiler,' TargetOS=',TargetOS,' TargetCPU=',TargetCPU,' SubTarget=',SubTarget,' CompilerOptions=',CompilerOptions,' ExtraOptions=',ExtraOptions,' PATH=',GetEnvironmentVariableUTF8('PATH')]);
|
||||
CompilerDate:=-1;
|
||||
if FileExistsCached(Compiler) then begin
|
||||
CompilerDate:=FileAgeCached(Compiler);
|
||||
ExtraOptions:=GetFPCInfoCmdLineOptions(ExtraOptions);// add -TTargetOS and -PTargetCPU
|
||||
ExtraOptions:=GetFPCInfoCmdLineOptions(ExtraOptions);// add -PTargetCPU -TTargetOS -tSubTarget
|
||||
BaseDir:='';
|
||||
|
||||
// check if this is a FPC compatible compiler and get version, OS and CPU
|
||||
@ -10771,9 +10794,22 @@ begin
|
||||
CTIncreaseChangeStamp(FChangeStamp);
|
||||
end;
|
||||
|
||||
function TPCTargetConfigCaches.Find(CompilerFilename: string;
|
||||
CreateIfNotExists: boolean): TPCTargetConfigCache;
|
||||
begin
|
||||
Result:=Find(CompilerFilename,'','','','',CreateIfNotExists);
|
||||
end;
|
||||
|
||||
function TPCTargetConfigCaches.Find(CompilerFilename, CompilerOptions,
|
||||
TargetOS, TargetCPU: string; CreateIfNotExists: boolean
|
||||
): TPCTargetConfigCache;
|
||||
begin
|
||||
Result:=Find(CompilerFilename,CompilerOptions,TargetOS,TargetCPU,'',CreateIfNotExists);
|
||||
end;
|
||||
|
||||
function TPCTargetConfigCaches.Find(CompilerFilename, CompilerOptions,
|
||||
TargetOS, TargetCPU, SubTarget: string; CreateIfNotExists: boolean
|
||||
): TPCTargetConfigCache;
|
||||
var
|
||||
Node: TAVLTreeNode;
|
||||
Cmp: TPCTargetConfigCache;
|
||||
@ -10784,6 +10820,7 @@ begin
|
||||
Cmp.CompilerOptions:=CompilerOptions;
|
||||
Cmp.TargetOS:=TargetOS;
|
||||
Cmp.TargetCPU:=TargetCPU;
|
||||
Cmp.SubTarget:=SubTarget;
|
||||
Node:=fItems.Find(cmp);
|
||||
if Node<>nil then begin
|
||||
Result:=TPCTargetConfigCache(Node.Data);
|
||||
@ -11438,7 +11475,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCompilerDefinesCache.FindUnitSet(const CompilerFilename, TargetOS,
|
||||
TargetCPU, Options, FPCSrcDir: string; CreateIfNotExists: boolean
|
||||
TargetCPU, SubTarget, Options, FPCSrcDir: string; CreateIfNotExists: boolean
|
||||
): TFPCUnitSetCache;
|
||||
var
|
||||
i: Integer;
|
||||
@ -11448,6 +11485,7 @@ begin
|
||||
if (CompareFilenames(Result.CompilerFilename,CompilerFilename)=0)
|
||||
and (SysUtils.CompareText(Result.TargetOS,TargetOS)=0)
|
||||
and (SysUtils.CompareText(Result.TargetCPU,TargetCPU)=0)
|
||||
and (SysUtils.CompareText(Result.SubTarget,SubTarget)=0)
|
||||
and (CompareFilenames(Result.FPCSourceDirectory,FPCSrcDir)=0)
|
||||
and (Result.CompilerOptions=Options)
|
||||
then
|
||||
@ -11459,6 +11497,7 @@ begin
|
||||
Result.CompilerOptions:=Options;
|
||||
Result.TargetOS:=TargetOS;
|
||||
Result.TargetCPU:=TargetCPU;
|
||||
Result.SubTarget:=SubTarget;
|
||||
Result.FPCSourceDirectory:=FPCSrcDir;
|
||||
fUnitToSrcCaches.Add(Result);
|
||||
end else
|
||||
@ -11468,37 +11507,47 @@ end;
|
||||
function TCompilerDefinesCache.FindUnitSetWithID(const UnitSetID: string; out
|
||||
Changed: boolean; CreateIfNotExists: boolean): TFPCUnitSetCache;
|
||||
var
|
||||
CompilerFilename, TargetOS, TargetCPU, Options, FPCSrcDir: string;
|
||||
CompilerFilename, TargetOS, TargetCPU, SubTarget, Options, FPCSrcDir: string;
|
||||
ChangeStamp: integer;
|
||||
begin
|
||||
ParseUnitSetID(UnitSetID,CompilerFilename, TargetOS, TargetCPU,
|
||||
ParseUnitSetID(UnitSetID,CompilerFilename, TargetOS, TargetCPU, SubTarget,
|
||||
Options, FPCSrcDir, ChangeStamp);
|
||||
//debugln(['TCompilerDefinesCache.FindUnitToSrcCache UnitSetID="',dbgstr(UnitSetID),'" CompilerFilename="',CompilerFilename,'" TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" Options="',Options,'" FPCSrcDir="',FPCSrcDir,'" ChangeStamp=',ChangeStamp,' exists=',FindUnitToSrcCache(CompilerFilename, TargetOS, TargetCPU,Options, FPCSrcDir,false)<>nil]);
|
||||
Result:=FindUnitSet(CompilerFilename, TargetOS, TargetCPU,
|
||||
Result:=FindUnitSet(CompilerFilename, TargetOS, TargetCPU, SubTarget,
|
||||
Options, FPCSrcDir, false);
|
||||
if Result<>nil then begin
|
||||
Changed:=ChangeStamp<>Result.ChangeStamp;
|
||||
end else if CreateIfNotExists then begin
|
||||
Changed:=true;
|
||||
Result:=FindUnitSet(CompilerFilename, TargetOS, TargetCPU,
|
||||
Result:=FindUnitSet(CompilerFilename, TargetOS, TargetCPU, SubTarget,
|
||||
Options, FPCSrcDir, true);
|
||||
end else
|
||||
Changed:=false;
|
||||
end;
|
||||
|
||||
function TCompilerDefinesCache.GetUnitSetID(CompilerFilename, TargetOS, TargetCPU,
|
||||
Options, FPCSrcDir: string; ChangeStamp: integer): string;
|
||||
function TCompilerDefinesCache.GetUnitSetID(CompilerFilename, TargetOS,
|
||||
TargetCPU, SubTarget, Options, FPCSrcDir: string; ChangeStamp: integer
|
||||
): string;
|
||||
|
||||
procedure Add(const aName, aValue: string);
|
||||
begin
|
||||
if aValue='' then exit;
|
||||
Result+=aName+'='+aValue+LineEnding;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:='CompilerFilename='+CompilerFilename+LineEnding
|
||||
+'TargetOS='+TargetOS+LineEnding
|
||||
+'TargetCPU='+TargetCPU+LineEnding
|
||||
+'Options='+Options+LineEnding
|
||||
+'FPCSrcDir='+FPCSrcDir+LineEnding
|
||||
+'Stamp='+IntToStr(ChangeStamp);
|
||||
Result:='';
|
||||
Add('CompilerFilename',CompilerFilename);
|
||||
Add('TargetOS',TargetOS);
|
||||
Add('TargetCPU',TargetCPU);
|
||||
Add('SubTarget',SubTarget);
|
||||
Add('Options',Options);
|
||||
Add('FPCSrcDir',FPCSrcDir);
|
||||
Add('Stamp',IntToStr(ChangeStamp));
|
||||
end;
|
||||
|
||||
procedure TCompilerDefinesCache.ParseUnitSetID(const ID: string;
|
||||
out CompilerFilename, TargetOS, TargetCPU, Options, FPCSrcDir: string;
|
||||
procedure TCompilerDefinesCache.ParseUnitSetID(const ID: string; out
|
||||
CompilerFilename, TargetOS, TargetCPU, SubTarget, Options, FPCSrcDir: string;
|
||||
out ChangeStamp: integer);
|
||||
var
|
||||
NameStartPos: PChar;
|
||||
@ -11523,6 +11572,7 @@ begin
|
||||
CompilerFilename:='';
|
||||
TargetCPU:='';
|
||||
TargetOS:='';
|
||||
SubTarget:='';
|
||||
Options:='';
|
||||
FPCSrcDir:='';
|
||||
ChangeStamp:=0;
|
||||
@ -11551,7 +11601,9 @@ begin
|
||||
Options:=Value;
|
||||
's','S':
|
||||
if NameFits('Stamp') then
|
||||
ChangeStamp:=StrToIntDef(Value,0);
|
||||
ChangeStamp:=StrToIntDef(Value,0)
|
||||
else if NameFits('SubTarget') then
|
||||
SubTarget:=Value;
|
||||
't','T':
|
||||
if NameFits('TargetOS') then
|
||||
TargetOS:=Value
|
||||
@ -11591,6 +11643,13 @@ begin
|
||||
ClearSourceCache;
|
||||
end;
|
||||
|
||||
procedure TFPCUnitSetCache.SetSubTarget(AValue: string);
|
||||
begin
|
||||
if FSubTarget=AValue then Exit;
|
||||
FSubTarget:=AValue;
|
||||
ClearConfigCache;
|
||||
end;
|
||||
|
||||
procedure TFPCUnitSetCache.SetTargetCPU(const AValue: string);
|
||||
begin
|
||||
if FTargetCPU=AValue then exit;
|
||||
@ -11869,7 +11928,7 @@ end;
|
||||
|
||||
function TFPCUnitSetCache.GetUnitSetID: string;
|
||||
begin
|
||||
Result:=Caches.GetUnitSetID(CompilerFilename,TargetOS,TargetCPU,
|
||||
Result:=Caches.GetUnitSetID(CompilerFilename,TargetOS,TargetCPU,SubTarget,
|
||||
CompilerOptions,FPCSourceDirectory,ChangeStamp);
|
||||
end;
|
||||
|
||||
|
@ -56,6 +56,7 @@ type
|
||||
function GetBuildMacroOverrides: TStrings; virtual; abstract;
|
||||
function GetTargetOS: string; virtual; abstract;
|
||||
function GetTargetCPU: string; virtual; abstract;
|
||||
function GetSubTarget: string; virtual; abstract;
|
||||
function GetLCLWidgetType: string; virtual; abstract;
|
||||
function GetRunCommandLine: string; virtual; abstract;
|
||||
function GetRunWorkingDir: string; virtual; abstract;
|
||||
|
@ -86,6 +86,7 @@ type
|
||||
// current target
|
||||
fTargetOS: string;
|
||||
fTargetCPU: string;
|
||||
fSubTarget: string;
|
||||
fLCLWidgetType: string;
|
||||
// cache
|
||||
FFPCompilerFilename: string;
|
||||
@ -148,16 +149,18 @@ type
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncSrcOS(const {%H-}Param: string; const Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncSubTarget(const {%H-}Param: string; const Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncTargetCmdLine(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncTargetCPU(const {%H-}Param: string; const Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncTargetFile(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncOutputFile(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncTargetOS(const {%H-}Param: string; const Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncOutputFile(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncIDEBuildOptions(const {%H-}Param: string; const Data: PtrInt;
|
||||
var {%H-}Abort: boolean): string;
|
||||
function MacroFuncPrimaryConfigPath(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||
@ -178,6 +181,7 @@ type
|
||||
// command line overrides
|
||||
OverrideTargetOS: string;
|
||||
OverrideTargetCPU: string;
|
||||
OverrideSubTarget: string;
|
||||
OverrideLCLWidgetType: string;
|
||||
DefaultCfgVars: TCTCfgScriptVariables;
|
||||
DefaultCfgVarsBuildMacroStamp: integer;
|
||||
@ -206,6 +210,7 @@ type
|
||||
function GetBuildMacroOverrides: TStrings; override;
|
||||
function GetTargetOS: string; override;
|
||||
function GetTargetCPU: string; override;
|
||||
function GetSubTarget: string; override;
|
||||
function GetLCLWidgetType: string; override;
|
||||
function GetRunCommandLine: string; override;
|
||||
function GetRunWorkingDir: string; override;
|
||||
@ -250,7 +255,7 @@ type
|
||||
function UpdateProjectAutomaticFiles(TestDir: string): TModalResult; override;
|
||||
|
||||
// methods for building IDE (will be changed when project groups are there)
|
||||
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string;
|
||||
procedure SetBuildTarget(const TargetOS, TargetCPU, SubTarget, LCLWidgetType: string;
|
||||
ScanFPCSrc: TScanModeFPCSources; Quiet: boolean);
|
||||
procedure SetBuildTargetProject1; override; overload;
|
||||
procedure SetBuildTargetProject1(Quiet: boolean; ScanFPCSrc: TScanModeFPCSources = smsfsBackground); overload;
|
||||
@ -444,6 +449,8 @@ begin
|
||||
lisTargetCPU,@MacroFuncTargetCPU,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('TargetOS','',
|
||||
lisTargetOS,@MacroFuncTargetOS,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('SubTarget','',
|
||||
lisTargetCPU,@MacroFuncSubTarget,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('SrcOS','',
|
||||
lisSrcOS,@MacroFuncSrcOS,[]));
|
||||
GlobalMacroList.Add(TTransferMacro.Create('CompPath','',
|
||||
@ -645,6 +652,11 @@ begin
|
||||
//debugln(['TBuildManager.GetTargetCPU ',Result]);
|
||||
end;
|
||||
|
||||
function TBuildManager.GetSubTarget: string;
|
||||
begin
|
||||
Result:=fSubTarget;
|
||||
end;
|
||||
|
||||
function TBuildManager.GetLCLWidgetType: string;
|
||||
begin
|
||||
Result:=fLCLWidgetType;
|
||||
@ -980,7 +992,7 @@ procedure TBuildManager.RescanCompilerDefines(ResetBuildTarget,
|
||||
end;
|
||||
|
||||
var
|
||||
TargetOS, TargetCPU, FPCOptions: string;
|
||||
TargetOS, TargetCPU, SubTarget, FPCOptions: string;
|
||||
CompilerFilename: String;
|
||||
FPCSrcDir: string;
|
||||
ADefTempl: TDefineTemplate;
|
||||
@ -1004,7 +1016,7 @@ begin
|
||||
CodeToolBoss.CompilerDefinesCache.SourceCaches.Clear;
|
||||
end;
|
||||
if ResetBuildTarget then
|
||||
SetBuildTarget('','','',smsfsSkip,true);
|
||||
SetBuildTarget('','','','',smsfsSkip,true);
|
||||
|
||||
// start the compiler and ask for his settings
|
||||
// provide an english message file
|
||||
@ -1013,6 +1025,7 @@ begin
|
||||
// use current TargetOS, TargetCPU, compilerfilename and FPC source dir
|
||||
TargetOS:=GetTargetOS;
|
||||
TargetCPU:=GetTargetCPU;
|
||||
SubTarget:=GetSubTarget;
|
||||
{$IFDEF VerboseFPCSrcScan}
|
||||
debugln(['TBuildManager.RescanCompilerDefines GetParsedFPCSourceDirectory needs FPCVer...']);
|
||||
{$ENDIF}
|
||||
@ -1027,6 +1040,7 @@ begin
|
||||
' Kind=',PascalCompilerNames[CompilerKind],
|
||||
' TargetOS=',TargetOS,
|
||||
' TargetCPU=',TargetCPU,
|
||||
' SubTarget=',SubTarget,
|
||||
' FPCOptions="',FPCOptions,'"',
|
||||
' EnvFPCSrcDir=',EnvironmentOptions.FPCSourceDirectory,
|
||||
' FPCSrcDir=',FPCSrcDir,
|
||||
@ -1044,7 +1058,7 @@ begin
|
||||
debugln(['TBuildManager.RescanCompilerDefines reading default compiler settings']);
|
||||
{$ENDIF}
|
||||
UnitSetCache:=CodeToolBoss.CompilerDefinesCache.FindUnitSet(
|
||||
DefCompilerFilename,'','','',FPCSrcDir,true);
|
||||
DefCompilerFilename,'','','','',FPCSrcDir,true);
|
||||
UnitSetCache.GetConfigCache(true);
|
||||
end;
|
||||
|
||||
@ -1087,9 +1101,9 @@ begin
|
||||
{$IFDEF VerboseFPCSrcScan}
|
||||
debugln(['TBuildManager.RescanCompilerDefines reading active compiler settings']);
|
||||
{$ENDIF}
|
||||
//debugln(['TBuildManager.RescanCompilerDefines ',CompilerFilename,' OS=',TargetOS,' CPU=',TargetCPU,' Options="',FPCOptions,'"']);
|
||||
//debugln(['TBuildManager.RescanCompilerDefines ',CompilerFilename,' OS=',TargetOS,' CPU=',TargetCPU,' SubTarget=',SubTarget,' Options="',FPCOptions,'"']);
|
||||
UnitSetCache:=CodeToolBoss.CompilerDefinesCache.FindUnitSet(
|
||||
CompilerFilename,TargetOS,TargetCPU,FPCOptions,FPCSrcDir,true);
|
||||
CompilerFilename,TargetOS,TargetCPU,SubTarget,FPCOptions,FPCSrcDir,true);
|
||||
|
||||
NeedUpdateFPCSrcCache:=false;
|
||||
//debugln(['TBuildManager.RescanCompilerDefines ',DirectoryExistsUTF8(FPCSrcDir),' ',(not WaitTillDone),' ',(not HasGUI)]);
|
||||
@ -1124,6 +1138,7 @@ begin
|
||||
' CompilerFilename=',CompilerFilename,
|
||||
' TargetOS=',TargetOS,
|
||||
' TargetCPU=',TargetCPU,
|
||||
' SubTarget=',SubTarget,
|
||||
' FPCOptions="',FPCOptions,'"',
|
||||
' RealCompiler=',UnitSetCache.GetConfigCache(false).RealCompiler,
|
||||
' EnvFPCSrcDir=',EnvironmentOptions.FPCSourceDirectory,
|
||||
@ -1203,6 +1218,8 @@ begin
|
||||
// check if at least one fpc config is there
|
||||
if (UnitSetCache.GetFirstFPCCfg='') then begin
|
||||
IgnorePath:='MissingFPCCfg_'+TargetOS+'-'+TargetCPU;
|
||||
if SubTarget<>'' then
|
||||
IgnorePath+='-'+SubTarget;
|
||||
if (InputHistories<>nil) and (InputHistories.Ignores.Find(IgnorePath)=nil)
|
||||
then begin
|
||||
MsgResult:=IDEMessageDialog(lisCCOWarningCaption,
|
||||
@ -2283,6 +2300,17 @@ begin
|
||||
Result:=GetDefaultSrcOSForTargetOS(GetTargetOS);
|
||||
end;
|
||||
|
||||
function TBuildManager.MacroFuncSubTarget(const Param: string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
begin
|
||||
if Data=CompilerOptionMacroPlatformIndependent then
|
||||
Result:='%(FPC_SUBTARGET)'
|
||||
else if SysUtils.CompareText(Param,'IDE')=0 then
|
||||
Result:=''
|
||||
else
|
||||
Result:=GetSubTarget;
|
||||
end;
|
||||
|
||||
function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
|
||||
@ -2913,7 +2941,7 @@ begin
|
||||
Result:=not Project1.BuildModes.IsSessionMode(Identifier);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetBuildTarget(const TargetOS, TargetCPU,
|
||||
procedure TBuildManager.SetBuildTarget(const TargetOS, TargetCPU, SubTarget,
|
||||
LCLWidgetType: string; ScanFPCSrc: TScanModeFPCSources; Quiet: boolean);
|
||||
|
||||
function GetEffectiveLCLWidgetType: string;
|
||||
@ -2932,6 +2960,7 @@ procedure TBuildManager.SetBuildTarget(const TargetOS, TargetCPU,
|
||||
var
|
||||
OldTargetOS: String;
|
||||
OldTargetCPU: String;
|
||||
OldSubTarget: String;
|
||||
OldLCLWidgetType: String;
|
||||
PCTargetChanged: Boolean;
|
||||
LCLTargetChanged: Boolean;
|
||||
@ -2940,13 +2969,15 @@ var
|
||||
CompQueryOptions, CompilerFilename: String;
|
||||
begin
|
||||
{$IFDEF VerboseDefaultCompilerTarget}
|
||||
debugln(['TBuildManager.SetBuildTarget TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" LCLWidgetType="',LCLWidgetType,'"']);
|
||||
debugln(['TBuildManager.SetBuildTarget TargetOS="',TargetOS,'" TargetCPU="',TargetCPU,'" SubTarget="',SubTarget,'" LCLWidgetType="',LCLWidgetType,'"']);
|
||||
{$ENDIF}
|
||||
OldTargetOS:=fTargetOS;
|
||||
OldTargetCPU:=fTargetCPU;
|
||||
OldSubTarget:=fSubTarget;
|
||||
OldLCLWidgetType:=fLCLWidgetType;
|
||||
OverrideTargetOS:=GetFPCTargetOS(TargetOS);
|
||||
OverrideTargetCPU:=GetFPCTargetCPU(TargetCPU);
|
||||
OverrideSubTarget:=GetFPCSubTarget(SubTarget);
|
||||
OverrideLCLWidgetType:=lowercase(LCLWidgetType);
|
||||
|
||||
// compute new TargetOS
|
||||
@ -2969,6 +3000,16 @@ begin
|
||||
if SysUtils.CompareText(fTargetCPU,'default')=0 then
|
||||
fTargetCPU:='';
|
||||
|
||||
// compute new SubTarget
|
||||
if OverrideSubTarget<>'' then
|
||||
fSubTarget:=OverrideSubTarget
|
||||
else if FBuildTarget<>nil then
|
||||
fSubTarget:=FBuildTarget.CompilerOptions.SubTarget
|
||||
else
|
||||
fSubTarget:='';
|
||||
if SysUtils.CompareText(fSubTarget,'default')=0 then
|
||||
fSubTarget:='';
|
||||
|
||||
if (fTargetOS='') or (fTargetCPU='') then
|
||||
begin
|
||||
// use compiler default target
|
||||
@ -3004,6 +3045,7 @@ begin
|
||||
|
||||
PCTargetChanged:=(OldTargetOS<>fTargetOS)
|
||||
or (OldTargetCPU<>fTargetCPU)
|
||||
or (OldSubTarget<>fSubTarget)
|
||||
or (CodeToolBoss.DefineTree.FindDefineTemplateByName(
|
||||
StdDefTemplLazarusSources,true)=nil);
|
||||
if PCTargetChanged then
|
||||
@ -3018,9 +3060,10 @@ begin
|
||||
|
||||
if PCTargetChanged or LCLTargetChanged then begin
|
||||
if ConsoleVerbosity>=0 then
|
||||
DebugLn(['Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=',OldTargetCPU,
|
||||
'-',OldTargetOS,'-',OldLCLWidgetType,' New=',fTargetCPU,'-',fTargetOS,
|
||||
'-',fLCLWidgetType,' Changed: OS/CPU=',PCTargetChanged,' LCL=',LCLTargetChanged]);
|
||||
DebugLn(['Hint: (lazarus) [TBuildManager.SetBuildTarget]',
|
||||
' Old=',OldTargetCPU,'-',OldTargetOS,'-',OldSubTarget,'-',OldLCLWidgetType,
|
||||
' New=',fTargetCPU,'-',fTargetOS,'-',fSubTarget,'-',fLCLWidgetType,
|
||||
' Changed: OS/CPU=',PCTargetChanged,' LCL=',LCLTargetChanged]);
|
||||
end;
|
||||
if LCLTargetChanged then
|
||||
CodeToolBoss.SetGlobalValue(ExternalMacroStart+'LCLWidgetType',fLCLWidgetType);
|
||||
@ -3043,25 +3086,26 @@ begin
|
||||
FBuildTarget:=Project1;
|
||||
if FBuildTarget<>nil then
|
||||
FBuildTarget.IDEOptions.AddHandlerDestroy(@OnProjectDestroy);
|
||||
SetBuildTarget('','','',ScanFPCSrc,Quiet);
|
||||
SetBuildTarget('','','','',ScanFPCSrc,Quiet);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetBuildTargetIDE(aQuiet: boolean);
|
||||
var
|
||||
NewTargetOS: String;
|
||||
NewTargetCPU: String;
|
||||
NewLCLWidgetSet: String;
|
||||
NewLCLWidgetSet, NewSubTarget: String;
|
||||
begin
|
||||
//debugln(['TBuildManager.SetBuildTargetIDE START']);
|
||||
FBuildTarget:=nil;
|
||||
with MiscellaneousOptions do begin
|
||||
NewTargetOS:=BuildLazOpts.TargetOS;
|
||||
NewTargetCPU:=BuildLazOpts.TargetCPU;
|
||||
NewSubTarget:=BuildLazOpts.SubTarget;
|
||||
NewLCLWidgetSet:=LCLPlatformDirNames[BuildLazOpts.TargetPlatform];
|
||||
end;
|
||||
if ConsoleVerbosity>=1 then
|
||||
debugln(['Hint: (lazarus) [TBuildManager.SetBuildTargetIDE] OS=',NewTargetOS,' CPU=',NewTargetCPU,' WS=',NewLCLWidgetSet]);
|
||||
SetBuildTarget(NewTargetOS,NewTargetCPU,NewLCLWidgetSet,smsfsBackground,aQuiet);
|
||||
debugln(['Hint: (lazarus) [TBuildManager.SetBuildTargetIDE] OS=',NewTargetOS,' CPU=',NewTargetCPU,' SubTarget=',NewSubTarget,' WS=',NewLCLWidgetSet]);
|
||||
SetBuildTarget(NewTargetOS,NewTargetCPU,NewSubTarget,NewLCLWidgetSet,smsfsBackground,aQuiet);
|
||||
end;
|
||||
|
||||
function TBuildManager.BuildTargetIDEIsDefault: boolean;
|
||||
|
@ -63,6 +63,7 @@ type
|
||||
FCleanOnce: boolean;
|
||||
fOwnerCnt: TBuildLazarusProfiles;
|
||||
fName: string;
|
||||
FSubTarget: string;
|
||||
fTargetOS: string;
|
||||
fTargetDirectory: string;
|
||||
fTargetCPU: string;
|
||||
@ -89,6 +90,7 @@ type
|
||||
property TargetOS: string read fTargetOS write fTargetOS;
|
||||
property TargetDirectory: string read fTargetDirectory write fTargetDirectory;
|
||||
property TargetCPU: string read fTargetCPU write fTargetCPU;
|
||||
property SubTarget: string read FSubTarget write FSubTarget;
|
||||
property TargetPlatform: TLCLPlatform read fTargetPlatform write fTargetPlatform;
|
||||
property IdeBuildMode: TIdeBuildMode read fIdeBuildMode write fIdeBuildMode;
|
||||
property CleanOnce: boolean read FCleanOnce write FCleanOnce;
|
||||
@ -219,6 +221,7 @@ var
|
||||
begin
|
||||
TargetOS :=XMLConfig.GetValue(Path+'TargetOS/Value','');
|
||||
TargetCPU :=XMLConfig.GetValue(Path+'TargetCPU/Value','');
|
||||
SubTarget :=XMLConfig.GetValue(Path+'SubTarget/Value','');
|
||||
LCLPlatformStr:=XMLConfig.GetValue(Path+'LCLPlatform/Value','');
|
||||
if LCLPlatformStr='' then
|
||||
fTargetPlatform:=GetDefaultLCLWidgetType
|
||||
@ -239,6 +242,7 @@ procedure TBuildLazarusProfile.Save(XMLConfig: TXMLConfig; const Path: string);
|
||||
begin
|
||||
XMLConfig.SetDeleteValue(Path+'TargetOS/Value',TargetOS,'');
|
||||
XMLConfig.SetDeleteValue(Path+'TargetCPU/Value',TargetCPU,'');
|
||||
XMLConfig.SetDeleteValue(Path+'SubTarget/Value',SubTarget,'');
|
||||
XMLConfig.SetDeleteValue(Path+'LCLPlatform/Value',
|
||||
LCLPlatformDirNames[fTargetPlatform],
|
||||
'');
|
||||
@ -259,6 +263,7 @@ begin
|
||||
TargetOS :=Source.TargetOS;
|
||||
TargetDirectory :=Source.TargetDirectory;
|
||||
TargetCPU :=Source.TargetCPU;
|
||||
SubTarget :=Source.SubTarget;
|
||||
TargetPlatform :=Source.TargetPlatform;
|
||||
IdeBuildMode :=Source.IdeBuildMode;
|
||||
CleanOnce :=Source.CleanOnce;
|
||||
|
@ -618,7 +618,7 @@ begin
|
||||
TargetProcessor:='';
|
||||
|
||||
UnitSetCache:=Boss.CompilerDefinesCache.FindUnitSet(CompilerPath,
|
||||
TargetOS,TargetProcessor,'',FPCSrcDir,true);
|
||||
TargetOS,TargetProcessor,'','',FPCSrcDir,true);
|
||||
|
||||
// create directory defines
|
||||
DirTemplate:=TDefineTemplate.Create('FPC Project ('+FileNames[0]+')',
|
||||
@ -727,7 +727,7 @@ begin
|
||||
DebugLn(' FPCSrcDir="',FPCSrcDir,'"');
|
||||
|
||||
UnitSetCache:=Boss.CompilerDefinesCache.FindUnitSet(CompilerPath,
|
||||
TargetOS,TargetProcessor,'',FPCSrcDir,true);
|
||||
TargetOS,TargetProcessor,'','',FPCSrcDir,true);
|
||||
// create FPC Source defines
|
||||
FPCSrcTemplate:=CreateFPCSourceTemplate(UnitSetCache,CodeToolsOpts);
|
||||
if FPCSrcTemplate=nil then begin
|
||||
|
@ -1625,6 +1625,7 @@ begin
|
||||
TargetProcessor := aXMLConfig.GetValue(p+'TargetProcessor/Value', '');
|
||||
TargetCPU := aXMLConfig.GetValue(p+'TargetCPU/Value', '');
|
||||
TargetOS := aXMLConfig.GetValue(p+'TargetOS/Value', '');
|
||||
SubTarget := aXMLConfig.GetValue(p+'SubTarget/Value', '');
|
||||
OptimizationLevel := aXMLConfig.GetValue(p+'Optimizations/OptimizationLevel/Value', 1);
|
||||
VariablesInRegisters := aXMLConfig.GetValue(p+'Optimizations/VariablesInRegisters/Value', false);
|
||||
UncertainOptimizations := aXMLConfig.GetValue(p+'Optimizations/UncertainOptimizations/Value', false);
|
||||
@ -1835,6 +1836,7 @@ begin
|
||||
aXMLConfig.SetDeleteValue(p+'TargetProcessor/Value', TargetProcessor,'');
|
||||
aXMLConfig.SetDeleteValue(p+'TargetCPU/Value', TargetCPU,'');
|
||||
aXMLConfig.SetDeleteValue(p+'TargetOS/Value', TargetOS,'');
|
||||
aXMLConfig.SetDeleteValue(p+'SubTarget/Value', SubTarget,'');
|
||||
aXMLConfig.SetDeleteValue(p+'Optimizations/OptimizationLevel/Value', OptimizationLevel,1);
|
||||
aXMLConfig.SetDeleteValue(p+'Optimizations/VariablesInRegisters/Value', VariablesInRegisters,false);
|
||||
aXMLConfig.SetDeleteValue(p+'Optimizations/UncertainOptimizations/Value', UncertainOptimizations,false);
|
||||
@ -2645,6 +2647,9 @@ begin
|
||||
if (CurTargetCPU<>'')
|
||||
and ((TargetCPU<>'') or (CurTargetCPU<>DefaultTargetCPU)) then
|
||||
Result.Add('-P' + CurTargetCPU);
|
||||
{ SubTarget }
|
||||
if SubTarget<>'' then
|
||||
Result.Add('-t'+SubTarget);
|
||||
{ TargetProcessor }
|
||||
if TargetProcessor<>'' then
|
||||
Result.Add('-Cp'+UpperCase(TargetProcessor));
|
||||
|
@ -108,8 +108,7 @@ end;
|
||||
procedure TIDEFPCInfoDialog.UpdateValuesMemo;
|
||||
var
|
||||
sl: TStringList;
|
||||
TargetOS: String;
|
||||
TargetCPU: String;
|
||||
TargetOS, TargetCPU, SubTarget: String;
|
||||
CompilerFilename: String;
|
||||
FPCSrcDir: String;
|
||||
UnitSetCache: TFPCUnitSetCache;
|
||||
@ -124,10 +123,11 @@ begin
|
||||
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
SubTarget:=BuildBoss.GetSubTarget;
|
||||
CompilerFilename:=LazarusIDE.GetCompilerFilename;
|
||||
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory; // needs FPCVer macro
|
||||
UnitSetCache:=CodeToolBoss.CompilerDefinesCache.FindUnitSet(
|
||||
CompilerFilename,TargetOS,TargetCPU,'',FPCSrcDir,true);
|
||||
CompilerFilename,TargetOS,TargetCPU,SubTarget,'',FPCSrcDir,true);
|
||||
GatherFPCExecutable(UnitSetCache,sl);
|
||||
|
||||
ValuesMemo.Lines.Assign(sl);
|
||||
@ -138,10 +138,7 @@ end;
|
||||
|
||||
procedure TIDEFPCInfoDialog.UpdateCmdLinePage;
|
||||
var
|
||||
TargetOS: String;
|
||||
TargetCPU: String;
|
||||
CompilerFilename: String;
|
||||
CompilerOptions: String;
|
||||
TargetOS, TargetCPU, SubTarget, CompilerFilename, CompilerOptions: String;
|
||||
Cfg: TPCTargetConfigCache;
|
||||
Params: String;
|
||||
ExtraOptions: String;
|
||||
@ -191,8 +188,9 @@ begin
|
||||
// fpc -va
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
SubTarget:=BuildBoss.GetSubTarget;
|
||||
Cfg:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
|
||||
CompilerFilename,CompilerOptions,TargetOS,TargetCPU,true);
|
||||
CompilerFilename,CompilerOptions,TargetOS,TargetCPU,SubTarget,true);
|
||||
TestFilename:=CodeToolBoss.CompilerDefinesCache.TestFilename;
|
||||
Filename:=ExtractFileName(TestFilename);
|
||||
WorkDir:=ExtractFilePath(TestFilename);
|
||||
@ -293,6 +291,7 @@ begin
|
||||
sl.Add('Active target:');
|
||||
sl.Add('TargetOS='+BuildBoss.GetTargetOS);
|
||||
sl.Add('TargetCPU='+BuildBoss.GetTargetCPU);
|
||||
sl.Add('SubTarget='+BuildBoss.GetSubTarget);
|
||||
sl.Add('');
|
||||
end;
|
||||
|
||||
|
@ -354,7 +354,7 @@ begin
|
||||
sl.Add('FPC source directory='+EnvironmentOptions.FPCSourceDirectory);
|
||||
sl.Add('Real FPC source directory='+EnvironmentOptions.GetParsedFPCSourceDirectory);
|
||||
CfgCache:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
|
||||
LazarusIDE.GetFPCompilerFilename,'','','',true);
|
||||
LazarusIDE.GetFPCompilerFilename,true);
|
||||
if CheckFPCSrcDirQuality(EnvironmentOptions.GetParsedFPCSourceDirectory,Note,
|
||||
CfgCache.GetFPCVer)<>sddqCompatible
|
||||
then
|
||||
|
@ -949,7 +949,7 @@ begin
|
||||
begin
|
||||
// check compiler again
|
||||
CfgCache:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
|
||||
fLastParsedCompiler,'','','',true);
|
||||
fLastParsedCompiler,true);
|
||||
CfgCache.CompilerDate:=0; // force update
|
||||
if CfgCache.NeedsUpdate then
|
||||
CfgCache.Update(CodeToolBoss.CompilerDefinesCache.TestFilename);
|
||||
|
@ -393,7 +393,7 @@ begin
|
||||
if TestSrcFilename<>'' then
|
||||
begin
|
||||
CfgCache:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
|
||||
AFilename,'','','',true);
|
||||
AFilename,true);
|
||||
if CfgCache.NeedsUpdate then
|
||||
CfgCache.Update(TestSrcFilename);
|
||||
i:=CfgCache.IndexOfUsedCfgFile;
|
||||
@ -700,7 +700,7 @@ begin
|
||||
if TestSrcFilename<>'' then
|
||||
begin
|
||||
CfgCache:=CodeToolBoss.CompilerDefinesCache.ConfigCaches.Find(
|
||||
AFilename,'','','',true);
|
||||
AFilename,true);
|
||||
if CfgCache.NeedsUpdate then
|
||||
CfgCache.Update(TestSrcFilename);
|
||||
i:=CfgCache.IndexOfUsedCfgFile;
|
||||
|
Loading…
Reference in New Issue
Block a user