mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 19:29:31 +02:00
IDE: started env getparsed funcs
git-svn-id: trunk@36052 -
This commit is contained in:
parent
dfc84d8ae3
commit
fee4e78df4
@ -648,7 +648,7 @@ begin
|
||||
// use current TargetOS, TargetCPU, compilerfilename and FPC source dir
|
||||
TargetOS:=GetTargetOS;
|
||||
TargetCPU:=GetTargetCPU;
|
||||
CompilerFilename:=EnvironmentOptions.GetCompilerFilename;
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory; // needs FPCVer macro
|
||||
|
||||
{$IFDEF VerboseFPCSrcScan}
|
||||
@ -1544,7 +1544,7 @@ function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
||||
if CodeToolBoss<>nil then begin
|
||||
// fetch the FPC version from the current compiler
|
||||
// Not from the fpc.exe, but from the real compiler
|
||||
CompilerFilename:=EnvironmentOptions.GetCompilerFilename;
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
if CompilerFilename='' then exit;
|
||||
TargetOS:=GetTargetOS;
|
||||
TargetCPU:=GetTargetCPU;
|
||||
|
@ -259,7 +259,7 @@ type
|
||||
fMsgViewFocus: boolean;
|
||||
|
||||
// compiler + debugger + lazarus files
|
||||
FLazarusDirectory: string;
|
||||
FParseValues: array[TEnvOptParseType] of TParseString;
|
||||
FLazarusDirHistory: TStringList;
|
||||
FCompilerFilename: string;
|
||||
FCompilerFilenameParsed: string;
|
||||
@ -335,6 +335,7 @@ type
|
||||
FFileDialogFilter: string;
|
||||
|
||||
function GetDebuggerEventLogColors(AIndex: TDBGEventType): TDebuggerEventLogColor;
|
||||
function GetLazarusDirectory: string;
|
||||
procedure SetCompilerFilename(const AValue: string);
|
||||
procedure SetDebuggerEventLogColors(AIndex: TDBGEventType;
|
||||
const AValue: TDebuggerEventLogColor);
|
||||
@ -343,6 +344,7 @@ type
|
||||
procedure SetDebuggerFilename(const AValue: string);
|
||||
procedure SetFPCSourceDirectory(const AValue: string);
|
||||
procedure SetLazarusDirectory(const AValue: string);
|
||||
procedure SetParseValue(o: TEnvOptParseType; const NewValue: string);
|
||||
|
||||
procedure InitLayoutList;
|
||||
procedure SetFileName(const NewFilename: string);
|
||||
@ -363,8 +365,9 @@ type
|
||||
procedure CreateConfig;
|
||||
function GetParsedLazarusDirectory: string;
|
||||
function GetParsedTestBuildDirectory: string;
|
||||
function GetCompilerFilename: string;
|
||||
function GetParsedCompilerFilename: string;
|
||||
function GetParsedFPCSourceDirectory: string;
|
||||
function GetParsedValue(o: TEnvOptParseType): string;
|
||||
|
||||
// macro functions
|
||||
procedure InitMacros(AMacroList: TTransferMacroList);
|
||||
@ -473,7 +476,7 @@ type
|
||||
write FShowHintsForMainSpeedButtons;
|
||||
|
||||
// files
|
||||
property LazarusDirectory: string read FLazarusDirectory
|
||||
property LazarusDirectory: string read GetLazarusDirectory
|
||||
write SetLazarusDirectory;
|
||||
property LazarusDirHistory: TStringList read FLazarusDirHistory
|
||||
write FLazarusDirHistory;
|
||||
@ -1115,7 +1118,7 @@ begin
|
||||
if not OnlyDesktop then begin
|
||||
// files
|
||||
s:=TrimFilename(
|
||||
XMLConfig.GetValue(Path+'LazarusDirectory/Value',FLazarusDirectory));
|
||||
XMLConfig.GetValue(Path+'LazarusDirectory/Value',LazarusDirectory));
|
||||
if not FilenameIsAbsolute(s) then
|
||||
s:=TrimFilename(AppendPathDelim(GetPrimaryConfigPath)+s);
|
||||
LazarusDirectory:=s;
|
||||
@ -1455,7 +1458,7 @@ begin
|
||||
|
||||
if not OnlyDesktop then begin
|
||||
// files
|
||||
CurLazDir:=ChompPathDelim(FLazarusDirectory);
|
||||
CurLazDir:=ChompPathDelim(LazarusDirectory);
|
||||
BaseDir:=ExtractFilePath(ChompPathDelim(GetPrimaryConfigPath));
|
||||
if (CompareFilenames(BaseDir,CurLazDir)=0)
|
||||
or FileIsInPath(CurLazDir,BaseDir) then begin
|
||||
@ -1693,7 +1696,29 @@ begin
|
||||
Result:=FFPCSrcDirParsed;
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.GetCompilerFilename: string;
|
||||
function TEnvironmentOptions.GetParsedValue(o: TEnvOptParseType): string;
|
||||
begin
|
||||
with FParseValues[o] do begin
|
||||
if (ParseStamp<>CompilerParseStamp)
|
||||
or (CompilerParseStamp=CTInvalidChangeStamp) then begin
|
||||
if Parsing then begin
|
||||
debugln(['TEnvironmentOptions.GetParsedValue circular macro dependency: ',dbgs(o)]);
|
||||
exit('circularmacroerror');
|
||||
end;
|
||||
Parsing:=true;
|
||||
try
|
||||
ParsedValue:=UnparsedValue;
|
||||
GlobalMacroList.SubstituteStr(ParsedValue);
|
||||
ParseStamp:=CompilerParseStamp;
|
||||
finally
|
||||
Parsing:=false;
|
||||
end;
|
||||
end;
|
||||
Result:=ParsedValue;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.GetParsedCompilerFilename: string;
|
||||
begin
|
||||
if (FCompilerFilenameParsedStamp=CTInvalidChangeStamp)
|
||||
or (FCompilerFilenameParsedStamp<>CompilerParseStamp)
|
||||
@ -1730,7 +1755,7 @@ end;
|
||||
function TEnvironmentOptions.MacroFuncCompPath(const s: string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
begin
|
||||
Result:=GetCompilerFilename;
|
||||
Result:=GetParsedCompilerFilename;
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.MacroFuncFPCSrcDir(const s: string;
|
||||
@ -1869,8 +1894,17 @@ var
|
||||
NewValue: String;
|
||||
begin
|
||||
NewValue:=AppendPathDelim(TrimFilename(AValue));
|
||||
if FLazarusDirectory=NewValue then exit;
|
||||
FLazarusDirectory:=NewValue;
|
||||
if LazarusDirectory=NewValue then exit;
|
||||
SetParseValue(eopLazarusDirectory,NewValue);
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetParseValue(o: TEnvOptParseType;
|
||||
const NewValue: string);
|
||||
begin
|
||||
with FParseValues[o] do begin
|
||||
UnparsedValue:=NewValue;
|
||||
ParseStamp:=CTInvalidChangeStamp;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetFPCSourceDirectory(const AValue: string);
|
||||
@ -1892,6 +1926,11 @@ begin
|
||||
Result := FDebuggerEventLogColors[AIndex];
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.GetLazarusDirectory: string;
|
||||
begin
|
||||
Result:=FParseValues[eopLazarusDirectory].UnparsedValue;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetDebuggerEventLogColors(AIndex: TDBGEventType; const AValue: TDebuggerEventLogColor);
|
||||
begin
|
||||
FDebuggerEventLogColors[AIndex] := AValue;
|
||||
|
@ -105,7 +105,7 @@ begin
|
||||
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
CompilerFilename:=EnvironmentOptions.GetCompilerFilename;
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory; // needs FPCVer macro
|
||||
UnitSetCache:=CodeToolBoss.FPCDefinesCache.FindUnitSet(
|
||||
CompilerFilename,TargetOS,TargetCPU,'',FPCSrcDir,true);
|
||||
@ -134,7 +134,7 @@ var
|
||||
begin
|
||||
TargetOS:=BuildBoss.GetTargetOS;
|
||||
TargetCPU:=BuildBoss.GetTargetCPU;
|
||||
CompilerFilename:=EnvironmentOptions.GetCompilerFilename;
|
||||
CompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
CompilerOptions:='';
|
||||
Cfg:=CodeToolBoss.FPCDefinesCache.ConfigCaches.Find(
|
||||
CompilerFilename,CompilerOptions,TargetOS,TargetCPU,true);
|
||||
@ -230,7 +230,7 @@ begin
|
||||
sl.add('Global IDE options:');
|
||||
sl.Add('LazarusDirectory='+EnvironmentOptions.LazarusDirectory);
|
||||
sl.Add('CompilerFilename='+EnvironmentOptions.CompilerFilename);
|
||||
sl.Add('ResolvedCompilerFilename='+EnvironmentOptions.GetCompilerFilename);
|
||||
sl.Add('ResolvedCompilerFilename='+EnvironmentOptions.GetParsedCompilerFilename);
|
||||
sl.Add('CompilerMessagesFilename='+EnvironmentOptions.CompilerMessagesFilename);
|
||||
sl.Add('');
|
||||
end;
|
||||
|
@ -223,7 +223,7 @@ begin
|
||||
sl.Add('Secondary config directory='+GetSecondaryConfigPath);
|
||||
sl.Add('LazarusDirectory='+EnvironmentOptions.LazarusDirectory);
|
||||
sl.Add('CompilerFilename='+EnvironmentOptions.CompilerFilename);
|
||||
sl.Add('Real CompilerFilename='+EnvironmentOptions.GetCompilerFilename);
|
||||
sl.Add('Real CompilerFilename='+EnvironmentOptions.GetParsedCompilerFilename);
|
||||
sl.Add('CompilerMessagesFilename='+EnvironmentOptions.CompilerMessagesFilename);
|
||||
sl.Add('FPC source directory='+EnvironmentOptions.FPCSourceDirectory);
|
||||
sl.Add('Real FPC source directory='+EnvironmentOptions.GetParsedFPCSourceDirectory);
|
||||
|
@ -575,7 +575,7 @@ var
|
||||
BestDir: TSDFileInfo;
|
||||
List: TObjectList;
|
||||
begin
|
||||
CompFile:=EnvironmentOptions.GetCompilerFilename;
|
||||
CompFile:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||
Quality:=CheckCompilerQuality(CompFile,Note,'');
|
||||
if Quality<>sddqInvalid then exit;
|
||||
debugln(['SetupCompilerFilename: The compiler path "',CompFile,'" is invalid (Error: ',Note,'). Searching a proper one ...']);
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -12487,7 +12487,7 @@ begin
|
||||
PkgCompileFlags:=PkgCompileFlags+[pcfCompileDependenciesClean];
|
||||
SourceEditorManager.ClearErrorLines;
|
||||
Result:=BuildLazarus(BuildLazProfiles,ExternalTools,GlobalMacroList,
|
||||
'',EnvironmentOptions.GetCompilerFilename,
|
||||
'',EnvironmentOptions.GetParsedCompilerFilename,
|
||||
EnvironmentOptions.MakeFilename, [blfDontBuild]);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Clean up failed.');
|
||||
@ -12542,7 +12542,7 @@ begin
|
||||
// make lazarus ide and/or examples
|
||||
SourceEditorManager.ClearErrorLines;
|
||||
Result:=BuildLazarus(BuildLazProfiles,ExternalTools,GlobalMacroList,
|
||||
PkgOptions,EnvironmentOptions.GetCompilerFilename,
|
||||
PkgOptions,EnvironmentOptions.GetParsedCompilerFilename,
|
||||
EnvironmentOptions.MakeFilename,IDEBuildFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
@ -14773,7 +14773,7 @@ begin
|
||||
'PROJECT',nil,@CTMacroFunctionProject);
|
||||
|
||||
CodeToolsOpts.AssignTo(CodeToolBoss);
|
||||
if (not FileExistsCached(EnvironmentOptions.GetCompilerFilename)) then begin
|
||||
if (not FileExistsCached(EnvironmentOptions.GetParsedCompilerFilename)) then begin
|
||||
DebugLn('');
|
||||
DebugLn('NOTE: Compiler filename not set! (see Environment / Options ... / Environment / Files)');
|
||||
end;
|
||||
@ -14800,14 +14800,14 @@ begin
|
||||
begin
|
||||
if (not ShowSetupDialog)
|
||||
and ((CheckLazarusDirectoryQuality(EnvironmentOptions.LazarusDirectory,Note)<>sddqCompatible)
|
||||
or (CheckCompilerQuality(EnvironmentOptions.GetCompilerFilename,Note,
|
||||
or (CheckCompilerQuality(EnvironmentOptions.GetParsedCompilerFilename,Note,
|
||||
CodeToolBoss.FPCDefinesCache.TestFilename)=sddqInvalid))
|
||||
then
|
||||
ShowSetupDialog:=true;
|
||||
if (not ShowSetupDialog) then
|
||||
begin
|
||||
CfgCache:=CodeToolBoss.FPCDefinesCache.ConfigCaches.Find(
|
||||
EnvironmentOptions.GetCompilerFilename,'','','',true);
|
||||
EnvironmentOptions.GetParsedCompilerFilename,'','','',true);
|
||||
if CheckFPCSrcDirQuality(EnvironmentOptions.GetParsedFPCSourceDirectory,Note,
|
||||
CfgCache.GetFPCVer)=sddqInvalid
|
||||
then
|
||||
|
@ -3696,7 +3696,7 @@ begin
|
||||
IDAsString]);
|
||||
FPCMakeTool.WorkingDirectory:=APackage.Directory;
|
||||
FPCMakeTool.Filename:=FindFPCTool('fpcmake'+GetExecutableExt,
|
||||
EnvironmentOptions.GetCompilerFilename);
|
||||
EnvironmentOptions.GetParsedCompilerFilename);
|
||||
FPCMakeTool.CmdLineParams:='-q -TAll';
|
||||
FPCMakeTool.EnvironmentOverrides.Add(
|
||||
'FPCDIR='+EnvironmentOptions.GetParsedFPCSourceDirectory);
|
||||
|
Loading…
Reference in New Issue
Block a user