mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:35:57 +02:00
IDE: added macro FPC_FULLVERSION, added conditionals function GetProjValue for packages, only parameter now: FPC_FULLVERSION
git-svn-id: trunk@45958 -
This commit is contained in:
parent
0796ab86ce
commit
dd64d2e479
@ -772,6 +772,7 @@ type
|
|||||||
function GetUnitPaths: string;
|
function GetUnitPaths: string;
|
||||||
function GetFPCVerNumbers(out FPCVersion, FPCRelease, FPCPatch: integer): boolean;
|
function GetFPCVerNumbers(out FPCVersion, FPCRelease, FPCPatch: integer): boolean;
|
||||||
function GetFPCVer: string; // e.g. 2.7.1
|
function GetFPCVer: string; // e.g. 2.7.1
|
||||||
|
function GetFPC_FULLVERSION: integer; // e.g. 20701
|
||||||
function IndexOfUsedCfgFile: integer;
|
function IndexOfUsedCfgFile: integer;
|
||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
property ChangeStamp: integer read FChangeStamp;
|
property ChangeStamp: integer read FChangeStamp;
|
||||||
@ -7867,6 +7868,24 @@ begin
|
|||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFPCTargetConfigCache.GetFPC_FULLVERSION: integer;
|
||||||
|
var
|
||||||
|
v: String;
|
||||||
|
FPCVersion: integer;
|
||||||
|
FPCRelease: integer;
|
||||||
|
FPCPatch: integer;
|
||||||
|
begin
|
||||||
|
if Defines<>nil then
|
||||||
|
Result:=StrToIntDef(Defines['FPC_FULLVERSION'],0)
|
||||||
|
else
|
||||||
|
Result:=0;
|
||||||
|
if Result=0 then begin
|
||||||
|
v:={$I %FPCVERSION%};
|
||||||
|
SplitFPCVersion(v,FPCVersion,FPCRelease,FPCPatch);
|
||||||
|
Result:=(FPCVersion*100+FPCRelease)*100+FPCPatch;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFPCTargetConfigCache.IndexOfUsedCfgFile: integer;
|
function TFPCTargetConfigCache.IndexOfUsedCfgFile: integer;
|
||||||
begin
|
begin
|
||||||
if ConfigFiles=nil then exit(-1);
|
if ConfigFiles=nil then exit(-1);
|
||||||
|
@ -64,6 +64,7 @@ type
|
|||||||
FFPCSrcScans: TFPCSrcScans;
|
FFPCSrcScans: TFPCSrcScans;
|
||||||
// Macro FPCVer
|
// Macro FPCVer
|
||||||
FFPCVer: string;
|
FFPCVer: string;
|
||||||
|
FFPC_FULLVERSION: integer;
|
||||||
FFPCVerChangeStamp: integer;
|
FFPCVerChangeStamp: integer;
|
||||||
// Macro InstantFPCCache
|
// Macro InstantFPCCache
|
||||||
FMacroInstantFPCCache: string;
|
FMacroInstantFPCCache: string;
|
||||||
@ -87,6 +88,8 @@ type
|
|||||||
var {%H-}Abort: boolean): string;
|
var {%H-}Abort: boolean): string;
|
||||||
function MacroFuncFPCVer(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
function MacroFuncFPCVer(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||||
var {%H-}Abort: boolean): string;
|
var {%H-}Abort: boolean): string;
|
||||||
|
function MacroFuncFPC_FULLVERSION(const {%H-}Param: string; const {%H-}Data: PtrInt;
|
||||||
|
var {%H-}Abort: boolean): string;
|
||||||
function MacroFuncLCLWidgetType(const {%H-}Param: string; const Data: PtrInt;
|
function MacroFuncLCLWidgetType(const {%H-}Param: string; const Data: PtrInt;
|
||||||
var {%H-}Abort: boolean): string;
|
var {%H-}Abort: boolean): string;
|
||||||
function MacroFuncLazVer(const {%H-}Param: string; const Data: PtrInt;
|
function MacroFuncLazVer(const {%H-}Param: string; const Data: PtrInt;
|
||||||
@ -370,6 +373,8 @@ begin
|
|||||||
lisSrcOS,@MacroFuncSrcOS,[]));
|
lisSrcOS,@MacroFuncSrcOS,[]));
|
||||||
GlobalMacroList.Add(TTransferMacro.Create('FPCVer','',
|
GlobalMacroList.Add(TTransferMacro.Create('FPCVer','',
|
||||||
lisFPCVersionEG222, @MacroFuncFPCVer, []));
|
lisFPCVersionEG222, @MacroFuncFPCVer, []));
|
||||||
|
GlobalMacroList.Add(TTransferMacro.Create('FPC_FULLVERSION','',
|
||||||
|
lisFPCFullVersionEG20701, @MacroFuncFPC_FULLVERSION, []));
|
||||||
GlobalMacroList.Add(TTransferMacro.Create('Params','',
|
GlobalMacroList.Add(TTransferMacro.Create('Params','',
|
||||||
lisCommandLineParamsOfProgram,@MacroFuncParams,[]));
|
lisCommandLineParamsOfProgram,@MacroFuncParams,[]));
|
||||||
GlobalMacroList.Add(TTransferMacro.Create('ProjFile','',
|
GlobalMacroList.Add(TTransferMacro.Create('ProjFile','',
|
||||||
@ -2034,7 +2039,7 @@ end;
|
|||||||
function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
||||||
var Abort: boolean): string;
|
var Abort: boolean): string;
|
||||||
|
|
||||||
function Compute: string;
|
procedure Compute;
|
||||||
var
|
var
|
||||||
TargetOS: String;
|
TargetOS: String;
|
||||||
TargetCPU: String;
|
TargetCPU: String;
|
||||||
@ -2042,9 +2047,10 @@ function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
|||||||
ConfigCache: TFPCTargetConfigCache;
|
ConfigCache: TFPCTargetConfigCache;
|
||||||
s: string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
|
FFPC_FULLVERSION:=0;
|
||||||
if OverrideFPCVer<>'' then
|
if OverrideFPCVer<>'' then
|
||||||
exit(OverrideFPCVer);
|
FFPCVer:=OverrideFPCVer;
|
||||||
Result:={$I %FPCVERSION%}; // Version.Release.Patch
|
FFPCVer:={$I %FPCVERSION%}; // Version.Release.Patch
|
||||||
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
|
||||||
@ -2062,22 +2068,31 @@ function TBuildManager.MacroFuncFPCVer(const Param: string; const Data: PtrInt;
|
|||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Result:=ConfigCache.GetFPCVer;
|
FFPCVer:=ConfigCache.GetFPCVer;
|
||||||
|
FFPC_FULLVERSION:=ConfigCache.GetFPC_FULLVERSION;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FFPCVerChangeStamp<>CompilerParseStamp then
|
if FFPCVerChangeStamp<>CompilerParseStamp then
|
||||||
begin
|
begin
|
||||||
FFPCVer:=Compute;
|
Compute;
|
||||||
FFPCVerChangeStamp:=CompilerParseStamp;
|
FFPCVerChangeStamp:=CompilerParseStamp;
|
||||||
{$IFDEF VerboseFPCSrcScan}
|
{ $IFDEF VerboseFPCSrcScan}
|
||||||
debugln(['TBuildManager.MacroFuncFPCVer ',FFPCVer]);
|
debugln(['TBuildManager.MacroFuncFPCVer FPCVer=',FFPCVer,' FPC_FULLVERSION=',FFPC_FULLVERSION]);
|
||||||
{$ENDIF}
|
{ $ENDIF}
|
||||||
end;
|
end;
|
||||||
Result:=FFPCVer;
|
Result:=FFPCVer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBuildManager.MacroFuncFPC_FULLVERSION(const Param: string;
|
||||||
|
const Data: PtrInt; var Abort: boolean): string;
|
||||||
|
begin
|
||||||
|
if FFPCVerChangeStamp<>CompilerParseStamp then
|
||||||
|
MacroFuncFPCVer(Param,Data,Abort);
|
||||||
|
Result:=IntToStr(FFPC_FULLVERSION);
|
||||||
|
end;
|
||||||
|
|
||||||
function TBuildManager.MacroFuncParams(const Param: string; const Data: PtrInt;
|
function TBuildManager.MacroFuncParams(const Param: string; const Data: PtrInt;
|
||||||
var Abort: boolean): string;
|
var Abort: boolean): string;
|
||||||
begin
|
begin
|
||||||
|
@ -138,10 +138,14 @@ type
|
|||||||
{ TIDECfgScriptEngine }
|
{ TIDECfgScriptEngine }
|
||||||
|
|
||||||
TIDECfgScriptEngine = class(TCTConfigScriptEngine)
|
TIDECfgScriptEngine = class(TCTConfigScriptEngine)
|
||||||
|
private
|
||||||
|
FProjValuesAvailable: boolean;
|
||||||
protected
|
protected
|
||||||
function IsCustomFunction(FunctionName: PChar): boolean; override;
|
function IsCustomFunction(FunctionName: PChar): boolean; override;
|
||||||
procedure RunCustomSimpleFunction(FunctionName: PChar;
|
procedure RunCustomSimpleFunction(FunctionName: PChar;
|
||||||
Value: PCTCfgScriptVariable); override;
|
Value: PCTCfgScriptVariable); override;
|
||||||
|
public
|
||||||
|
property ProjValuesAvailable: boolean read FProjValuesAvailable write FProjValuesAvailable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -1018,6 +1022,7 @@ begin
|
|||||||
'G':
|
'G':
|
||||||
if (CompareIdentifiers(FunctionName,'GetIDEValue')=0)
|
if (CompareIdentifiers(FunctionName,'GetIDEValue')=0)
|
||||||
or (CompareIdentifiers(FunctionName,'GetEnv')=0)
|
or (CompareIdentifiers(FunctionName,'GetEnv')=0)
|
||||||
|
or (ProjValuesAvailable and (CompareIdentifiers(FunctionName,'GetProjValue')=0))
|
||||||
then exit(true);
|
then exit(true);
|
||||||
end;
|
end;
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -1027,6 +1032,7 @@ procedure TIDECfgScriptEngine.RunCustomSimpleFunction(FunctionName: PChar;
|
|||||||
Value: PCTCfgScriptVariable);
|
Value: PCTCfgScriptVariable);
|
||||||
var
|
var
|
||||||
VarName: String;
|
VarName: String;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
case UpChars[FunctionName^] of
|
case UpChars[FunctionName^] of
|
||||||
'G':
|
'G':
|
||||||
@ -1049,6 +1055,16 @@ begin
|
|||||||
begin
|
begin
|
||||||
VarName:=GetCTCSVariableAsString(Value);
|
VarName:=GetCTCSVariableAsString(Value);
|
||||||
SetCTCSVariableAsString(Value,GetEnvironmentVariableUTF8(VarName));
|
SetCTCSVariableAsString(Value,GetEnvironmentVariableUTF8(VarName));
|
||||||
|
end else if ProjValuesAvailable
|
||||||
|
and (CompareIdentifiers(FunctionName,'GetProjValue')=0) then
|
||||||
|
begin
|
||||||
|
VarName:=GetCTCSVariableAsString(Value);
|
||||||
|
if CompareIdentifiers(PChar(VarName),'FPC_FULLVERSION')=0 then
|
||||||
|
begin
|
||||||
|
s:='$(FPC_FULLVERSION)';
|
||||||
|
GlobalMacroList.SubstituteStr(s);
|
||||||
|
SetCTCSVariableAsNumber(Value,StrToIntDef(s,0));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -542,6 +542,8 @@ begin
|
|||||||
AddWord('GetIDEValue(''LCLWidgetType'')');
|
AddWord('GetIDEValue(''LCLWidgetType'')');
|
||||||
AddWord('GetEnv(''USER'')');
|
AddWord('GetEnv(''USER'')');
|
||||||
AddWord('GetEnv(''HOME'')');
|
AddWord('GetEnv(''HOME'')');
|
||||||
|
if FCompOptions is TPkgCompilerOptions then
|
||||||
|
AddWord('GetProjValue(''FPC_FULLVERSION'')');
|
||||||
|
|
||||||
// add result variables
|
// add result variables
|
||||||
for pcov:=low(ParsedCompilerOptsVars) to high(ParsedCompilerOptsVars) do
|
for pcov:=low(ParsedCompilerOptsVars) to high(ParsedCompilerOptsVars) do
|
||||||
|
@ -4953,6 +4953,7 @@ resourcestring
|
|||||||
lisTheUnitSearchPathOfContainsTheSourceDirectoryOfPac = 'The unit search '
|
lisTheUnitSearchPathOfContainsTheSourceDirectoryOfPac = 'The unit search '
|
||||||
+'path of "%s" contains the source directory "%s" of package %s';
|
+'path of "%s" contains the source directory "%s" of package %s';
|
||||||
lisFPCVersionEG222 = 'FPC Version (e.g. 2.2.2)';
|
lisFPCVersionEG222 = 'FPC Version (e.g. 2.2.2)';
|
||||||
|
lisFPCFullVersionEG20701 = 'FPC version as one number (e.g. 20701)';
|
||||||
lisLAZVer = 'Lazarus Version (e.g. 1.2.4)';
|
lisLAZVer = 'Lazarus Version (e.g. 1.2.4)';
|
||||||
lisMissingIdentifiers = 'Missing identifiers';
|
lisMissingIdentifiers = 'Missing identifiers';
|
||||||
lisChooseAFPDocLink = 'Choose a FPDoc link';
|
lisChooseAFPDocLink = 'Choose a FPDoc link';
|
||||||
|
@ -4093,6 +4093,7 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
if AOwner<>nil then
|
if AOwner<>nil then
|
||||||
FLazPackage := AOwner as TLazPackage;
|
FLazPackage := AOwner as TLazPackage;
|
||||||
|
ParsedOpts.MacroValues.ProjValuesAvailable:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TPkgCompilerOptions.GetGroupCaption: string;
|
class function TPkgCompilerOptions.GetGroupCaption: string;
|
||||||
|
@ -94,7 +94,7 @@ type
|
|||||||
procedure SetFilename(const AValue: string);
|
procedure SetFilename(const AValue: string);
|
||||||
procedure SetOrigin(const AValue: TPkgLinkOrigin);
|
procedure SetOrigin(const AValue: TPkgLinkOrigin);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function MakeSense: boolean;
|
function MakeSense: boolean;
|
||||||
function GetEffectiveFilename: string;
|
function GetEffectiveFilename: string;
|
||||||
|
@ -53,7 +53,7 @@ type
|
|||||||
FLPKInfo: TLPKInfo;
|
FLPKInfo: TLPKInfo;
|
||||||
FVisible: boolean;
|
FVisible: boolean;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
property Origin;
|
property Origin;
|
||||||
|
Loading…
Reference in New Issue
Block a user