IDE: macro CompPath: return project compiler, COmpPath(IDE) returns IDE compiler

git-svn-id: trunk@46858 -
This commit is contained in:
mattias 2014-11-15 12:38:51 +00:00
parent 799184edb2
commit 960141597a
2 changed files with 23 additions and 15 deletions

View File

@ -84,6 +84,8 @@ type
var {%H-}Abort: boolean): string;
function MacroFuncEnv(const Param: string; const {%H-}Data: PtrInt;
var {%H-}Abort: boolean): string;
function MacroFuncCompPath(const {%H-}s:string; const {%H-}Data: PtrInt;
var {%H-}Abort: boolean): string;
function MacroFuncFPCMsgFile(const {%H-}Param: string; const {%H-}Data: PtrInt;
var {%H-}Abort: boolean): string;
function MacroFuncFPCVer(const {%H-}Param: string; const {%H-}Data: PtrInt;
@ -374,10 +376,14 @@ begin
lisTargetOS,@MacroFuncTargetOS,[]));
GlobalMacroList.Add(TTransferMacro.Create('SrcOS','',
lisSrcOS,@MacroFuncSrcOS,[]));
GlobalMacroList.Add(TTransferMacro.Create('CompPath','',
lisCompilerFilename,@MacroFuncCompPath,[]));
GlobalMacroList.Add(TTransferMacro.Create('FPCVer','',
lisFPCVersionEG222, @MacroFuncFPCVer, []));
GlobalMacroList.Add(TTransferMacro.Create('FPC_FULLVERSION','',
lisFPCFullVersionEG20701, @MacroFuncFPC_FULLVERSION, []));
GlobalMacroList.Add(TTransferMacro.Create('FPCMsgFile','',
lisFPCMessageFile, @MacroFuncFPCMsgFile, []));
GlobalMacroList.Add(TTransferMacro.Create('Params','',
lisCommandLineParamsOfProgram,@MacroFuncParams,[]));
GlobalMacroList.Add(TTransferMacro.Create('ProjFile','',
@ -402,8 +408,6 @@ begin
lisProjectOutDir,@MacroFuncProjOutDir,[]));
GlobalMacroList.Add(TTransferMacro.Create('Env','',
lisEnvironmentVariableNameAsParameter, @MacroFuncEnv, []));
GlobalMacroList.Add(TTransferMacro.Create('FPCMsgFile','',
lisFPCMessageFile, @MacroFuncFPCMsgFile, []));
GlobalMacroList.Add(TTransferMacro.Create('MakeExe','',
lisMakeExe,@MacroFuncMakeExe,[]));
GlobalMacroList.Add(TTransferMacro.Create('MakeLib','',
@ -606,13 +610,16 @@ function TBuildManager.GetFPCompilerFilename: string;
var
s: string;
AProject: TProject;
Opts: TProjectCompilerOptions;
begin
Result:='';
if (FBuildTarget is TProject) then
begin
AProject:=TProject(FBuildTarget);
if ([crCompile,crBuild]*AProject.CompilerOptions.CompileReasons<>[])
and (AProject.CompilerOptions.CompilerPath<>'')
Opts:=AProject.CompilerOptions;
if ([crCompile,crBuild]*Opts.CompileReasons<>[])
and (Opts.CompilerPath<>'')
and (not Opts.ParsedOpts.Values[pcosCompilerPath].Parsing)
then begin
Result:=AProject.GetCompilerFilename;
//debugln(['TBuildManager.GetFPCompilerFilename project compiler="',Result,'"']);
@ -2214,6 +2221,18 @@ begin
Result:=GetEnvironmentVariableUTF8(Param);
end;
function TBuildManager.MacroFuncCompPath(const s: string; const Data: PtrInt;
var Abort: boolean): string;
// if parameter is 'IDE' return the environment option
// otherwise use active project's compiler
begin
Result:='';
if CompareText(s,'IDE')<>0 then
Result:=GetFPCompilerFilename;
if Result='' then
Result:=EnvironmentOptions.GetParsedCompilerFilename;
end;
function TBuildManager.MacroFuncFPCMsgFile(const Param: string;
const Data: PtrInt; var Abort: boolean): string;
begin

View File

@ -473,8 +473,6 @@ type
// macros
procedure InitMacros(AMacroList: TTransferMacroList);
function MacroFuncCompPath(const {%H-}s:string; const {%H-}Data: PtrInt;
var {%H-}Abort: boolean): string;
function MacroFuncFPCSrcDir(const {%H-}s:string; const {%H-}Data: PtrInt;
var {%H-}Abort: boolean): string;
function MacroFuncLazarusDir(const {%H-}s:string; const {%H-}Data: PtrInt;
@ -2084,8 +2082,6 @@ end;
procedure TEnvironmentOptions.InitMacros(AMacroList: TTransferMacroList);
begin
AMacroList.Add(TTransferMacro.Create('CompPath','',
lisCompilerFilename,@MacroFuncCompPath,[]));
AMacroList.Add(TTransferMacro.Create('FPCSrcDir','',
lisFreePascalSourceDirectory,@MacroFuncFPCSrcDir,[]));
AMacroList.Add(TTransferMacro.Create('LazarusDir','',
@ -2104,13 +2100,6 @@ begin
lisUserSHomeDirectory, nil, []));
end;
function TEnvironmentOptions.MacroFuncCompPath(const s: string;
const Data: PtrInt; var Abort: boolean): string;
// CompPath returns the default compiler file name of the environment options
begin
Result:=GetParsedCompilerFilename;
end;
function TEnvironmentOptions.MacroFuncFPCSrcDir(const s: string;
const Data: PtrInt; var Abort: boolean): string;
begin