From a625b39fbf8e12db9230acf3ca510ef15b18c4c6 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 26 Nov 2018 10:18:48 +0000 Subject: [PATCH] IDE: added IDE macro $(OutputFile), issue #27729, from elmar69 git-svn-id: trunk@59663 - --- components/ideintf/compoptsintf.pas | 1 + ide/buildmanager.pas | 13 +++++++++++++ ide/compileroptions.pp | 2 +- ide/lazarusidestrconsts.pas | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/ideintf/compoptsintf.pas b/components/ideintf/compoptsintf.pas index 4d5f1d1e79..757e2f6b3d 100644 --- a/components/ideintf/compoptsintf.pas +++ b/components/ideintf/compoptsintf.pas @@ -323,6 +323,7 @@ type function IsActive: boolean; virtual; function TrimCustomOptions(o: string): string; virtual; abstract; function CreatePPUFilename(const SourceFileName: string): string; virtual; abstract; + function CreateTargetFilename: string; virtual; abstract; function GetUnitOutputDirectory(RelativeToBaseDir: boolean): string; virtual; abstract; public property Owner: TObject read fOwner write fOwner; diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 3576231e81..a4b1d12f9d 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -143,6 +143,8 @@ type 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 MacroFuncIDEBuildOptions(const {%H-}Param: string; const Data: PtrInt; @@ -414,6 +416,8 @@ begin lisTargetFilenamePlusParams,@MacroFuncTargetCmdLine,[])); GlobalMacroList.Add(TTransferMacro.Create('RunCmdLine','', lisLaunchingCmdLine,@MacroFuncRunCmdLine,[])); + GlobalMacroList.Add(TTransferMacro.Create('OutputFile','', + lisOutputFilenameOfProject,@MacroFuncOutputFile,[])); GlobalMacroList.Add(TTransferMacro.Create('ProjPublishDir','', lisPublishProjDir,@MacroFuncProjPublishDir,[])); GlobalMacroList.Add(TTransferMacro.Create('ProjNamespaces','', @@ -2187,6 +2191,15 @@ begin Result:=''; end; +function TBuildManager.MacroFuncOutputFile(const Param: string; + const Data: PtrInt; var Abort: boolean): string; +begin + if Project1<>nil then + Result:=Project1.CompilerOptions.CreateTargetFilename + else + Result:=''; +end; + function TBuildManager.MacroFuncTargetCmdLine(const Param: string; const Data: PtrInt; var Abort: boolean): string; begin diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 40e2cb608e..bb27230232 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -486,7 +486,7 @@ type function MakeOptionsString(Flags: TCompilerCmdLineOptions): String; virtual; function GetSyntaxOptionsString(Kind: TPascalCompiler): string; virtual; function CreatePPUFilename(const SourceFileName: string): string; override; - function CreateTargetFilename: string; virtual; + function CreateTargetFilename: string; override; function GetTargetFileExt: string; virtual; function GetTargetFilePrefix: string; virtual; procedure GetInheritedCompilerOptions(var OptionsList: TFPList // list of TAdditionalCompilerOptions diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 318995e080..c67ff2caa9 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -235,6 +235,7 @@ resourcestring lisSaveAllModified = 'Save all modified files'; lisTargetFilenameOfProject = 'Target filename of project'; lisTargetFilenamePlusParams = 'Target filename + params'; + lisOutputFilenameOfProject = 'Output filename of project'; lisTestDirectory = 'Test directory'; lisLaunchingCmdLine = 'Launching target command line'; lisPublishProjDir = 'Publish project directory';