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