13

According to Delphi's help file, when I open the dialog box to add build events to my project's options, the dialog box should show a list of macros (placeholders) that I can use on the command line for the build event. When I try this in Delphi XE, the list of macros is empty. The help file doesn't say which macros are available either (that I could find).

So, which macros are available? Right now I need a macro for the full path to the compiled .exe file (post-build), and the full path to the .dproj file. But I'd like to have a complete list of the available macros for future reference.

Jan Goyvaerts
  • 21,379
  • 7
  • 60
  • 72

3 Answers3

13

I had to go back to D2010 to come up with this list:

BDS                 The environment variable $(BDS)
DEFINES             The project's conditional defines
DIR                 The environment variable $(DIR)
INCLUDEPATH         The project's include path
INPUTDIR            The input file's directory
INPUTEXT            The input file's extension
INPUTFILENAME       The input file's name, with extension
INPUTPATH           The input file's full path
LOCALCOMMAND        Local command entered by user in project manager
OUTPUTDIR           The output file's directory
OUTPUTEXT           The output file's extension
OUTPUTFILENAME      The output file's name, with extension
OUTPUTNAME          The output file's name, without extension
OUTPUTPATH          The output file's full path
Path                The environment variable $(PATH)
PROJECTDIR          The project's directory
PROJECTEXT          The project's extension
PROJECTFILENAME     The project file's name, with extension
PROJECTNAME         The project's name
PROJECTPATH         The project file's full path
SAVE                Save the input file to disk before it's compiled
SystemRoot          The environment variable $(SYSTEMROOT)
WINDIR              The environment variable $(WINDIR)
Jan Goyvaerts
  • 21,379
  • 7
  • 60
  • 72
Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Thanks. Stuff like this should be in the documentation, even if the app itself is supposed to show the list. – Jan Goyvaerts Apr 04 '11 at 02:09
  • @Jan: Thanks for fixing the formatting. I couldn't seem to get it quite right. :) – Ken White Apr 04 '11 at 02:16
  • @Ken: The trick was to use spaces instead of tabs to line up the second column. – Jan Goyvaerts Apr 04 '11 at 02:22
  • 1
    @Jan: Thanks. I'll have to keep that in mind in the future. (There's no way to copy and paste from the IDE's dialog, so I had to type everything out in Notepad, copy to the cliboard, switch back to FireFox, and paste it in the answer. I thought of a screenshot of the dialog, but you can't resize the bottom list of macros, so it would have taken a couple of images.) – Ken White Apr 04 '11 at 02:54
  • @Ken: Don't give in so quick. :-) Open the build-event dialog and make it tall. Start [EDA](http://www.delphipraxis.net/141178-%5Bfreeware-tools%5D-eda-preview-fenstereigenschaften-anzeigen.html), switch to "Modify window" tab, drag the window selector to the "Macros" groupbox, and increase DY. – Uli Gerhardt Apr 04 '11 at 07:40
  • @Ulrich: :) God advice. I'll have to look at that - I've used something like that before, but didn't think that fast last night. – Ken White Apr 04 '11 at 11:03
2

For starters, I think the one you want is $(PROJECTPATH) which will be the full name of the DPROJ file including its path.

This is a Bug in RAD XE. I have seen this too. It went away for me on Update 1. Wait. I mean, it's a regression in Update 1, that wasn't in RTM.

This is a screengrab from Delphi 2009:

enter image description here

Warren P
  • 65,725
  • 40
  • 181
  • 316
1

I have Update 1 installed, but still can't see them, however...

For the Output File use "$(OUTPUTDIR)$(OUTPUTFILENAME)" and the Project File use "$(ProjectDir)$(ProjectFileName)"

You can find a list of the available macros (if they aren't showing up in the IDE) in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets (sourced from What are the MSBuild project level properties for Delphi?)

Inside that file is the following area on my machine...

<!-- Build event properties settable in the IDE -->
    <ProjectName>$(MSBuildProjectName)</ProjectName>
    <ProjectFilename>$(MSBuildProjectFile)</ProjectFilename>
    <ProjectExt>$(MSBuildProjectExtension)</ProjectExt>
    <ProjectDir>$(MSBuildProjectDirectory)</ProjectDir>
    <ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>

    <InputPath>@(DelphiCompile->'%(FullPath)')</InputPath>
    <InputDir>@(DelphiCompile->'%(RootDir)%(Directory)')</InputDir>
    <InputName>@(DelphiCompile->'%(Filename)')</InputName>
    <InputExt>@(DelphiCompile->'%(Extension)')</InputExt>
    <InputFilename>@(DelphiCompile->'%(Filename)%(Extension)')</InputFilename>

    <OutputPath>@(_DependencyCheckOutputName->'%(FullPath)')</OutputPath>
    <OutputDir>@(_DependencyCheckOutputName->'%(RootDir)%(Directory)')</OutputDir>
    <OutputName>@(_DependencyCheckOutputName->'%(Filename)')</OutputName>
    <OutputExt>@(_DependencyCheckOutputName->'%(Extension)')</OutputExt>
    <OutputFilename>@(_DependencyCheckOutputName->'%(Filename)%(Extension)')</OutputFilename>

HTH

Community
  • 1
  • 1
GoldenTao
  • 246
  • 2
  • 5
  • I think you don't need the use BOTH ProjectDir and ProjectFilename, you can just use PROJECTPATH which is simpler. It combines those two for you. – Warren P Apr 04 '11 at 02:12