The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,723 other followers

Delphi XE8 does not adhere the `$(PROJECTNAME)` in a “Unit Output Directory”, but does recognise `$(SanitizedProjectName)`…

Posted by jpluimers on 2016/05/24

The background here was a quick project at a client where many .dproj files were in the same directory, but they suffered from conditional define differences. Which meant that even if they were all using the  DEBUG configuration, some defines in the .dproj directories were different therefore poisoning shared .DCU files (as Delphi does not automatically rebuild them when the sources have not changed even though the IDE switched to a new project).

There was no quick possibility to reorganise the project structure (a combination of a version system history being problematic and potentially lots of relative path references in the .dproj and .dpr files could still be broken) so I wanted different “Unit Output Directories” for each project preferably using non-hardcoded project name.

So I tried putting $(PROJECTNAME) in a “Unit Output Directory”. But unlike build-events – where that one has a value – in the Directory it hadn’t.

To cut things short, Uwe Raabe did some spelunking in the .dproj file and found that $(SanitizedProjectName) was recognised so I switched to .\$(Platform)\$(Config)\$(SanitizedProjectName)

So I did some more spelunking coming with the below list. Remember though:

Only tested for Win32 applications for Delphi XE8

I assembled the list by doing a quick sed on a Delphi XE8 Win32 .dproj file transforming all XML element names to $() form then running it through a uniq like script. After that I added each of them in a “Unit Output Directory” prepended with .\_\ (well I cheated a bit, I did them in groups separated by a back-slash and went back to single items in case of failures. A kind of ‘binary search’).

These expand to empty strings:

$(Android_LauncherIcon144)
$(Android_LauncherIcon36)
$(Android_LauncherIcon48)
$(Android_LauncherIcon72)
$(Android_LauncherIcon96)
$(Android_SplashImage426)
$(Android_SplashImage470)
$(Android_SplashImage640)
$(Android_SplashImage960)
$(Base_Android)
$(Base_iOSDevice32)
$(Base_iOSDevice64)
$(Base_iOSSimulator)
$(Base_OSX32)
$(Base_Win64)
$(Borland)
$(BorlandProject)
$(BuildConfiguration)
$(Cfg_2)
$(Cfg_2_Win32)
$(DCC_DebugInformation)
$(DCC_LocalDebugSymbols)
$(DCC_SymbolReferenceInfo)
$(DCCReference)
$(DelphiCompile)
$(DeployClass)
$(DeployFile)
$(Deployment)
$(EnabledSysJars)
$(Excluded_Packages)
$(Extensions)
$(Import)
$(ItemGroup)
$(Key)
$(Operation)
$(Overwrite)
$(Platforms)
$(ProjectExtensions)
$(ProjectFileVersion)
$(ProjectRoot)
$(PropertyGroup)
$(RemoteDir)
$(RemoteName)

These expand to a usable string that can be used in a Directory:

$(AppType)
$(Base)
$(Base_Win32)
$(Cfg_1)
$(Cfg_1_Win32)
$(CfgParent)
$(Config)
$(DCC_ConsoleTarget)
$(DCC_DebugDCUs)
$(DCC_DebugInfoInExe)
$(DCC_E)
$(DCC_F)
$(DCC_GenerateStackFrames)
$(DCC_K)
$(DCC_N)
$(DCC_Optimize)
$(DCC_RemoteDebug)
$(DCC_S)
$(FrameworkType)
$(MainSource)
$(Platform)
$(ProjectGuid)
$(ProjectVersion)
$(SanitizedProjectName)
$(Source)
$(TargetedPlatforms)
$(VerInfo_Locale)

These work sort of as they expand in a string with one or more back-slashes:

$(DCC_DcuOutput)
$(DCC_ExeOutput)

These fail as they expand to something not usable in a directory

$(DCC_Define)
$(DCC_Namespace)
$(Delphi)
$(DCC_UsePackage)
$(Manifest_File)
$(VerInfo_Keys)

Various error messages you get for failed parameters:

[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\VerInfo_Keys=CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[MakeDir Error] Unable to create directory ".\Manifest_File=c:\program files (x86)\embarcadero\studio\16.0\bin\default_app.manifest". The given path's format is not supported.
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\DCC_UsePackage=frxADO22;FireDACTDataDriver;FireDACSqliteDriver;...;IndyIPClient;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[MakeDir Error] Unable to create directory ".\Delphi=c:\program files (x86)\embarcadero\studio\16.0". The given path's format is not supported.
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web;Soap;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\DCC_Define=DEBUG;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets

–jeroen

Source: Since Delphi (XE8) does not adhere the $(PROJECTNAME) in a “Unit Output…

2 Responses to “Delphi XE8 does not adhere the `$(PROJECTNAME)` in a “Unit Output Directory”, but does recognise `$(SanitizedProjectName)`…”

  1. jpluimers said

    More details to do this from an option set are at https://plus.google.com/+DavidNottageDelphiExpert/posts/PcW8CwMQGmH

    David Nottage:
    +Uwe Raabe As good as that sounded, it doesn’t seem to work for me. My steps: Create a new multiplatform app, right-click Build Configurations, click New Option Set (and save it), change the Output directory option. It doesn’t seem to honour the changed setting. Am I missing something?

    Uwe Raabe:
    +David Nottage That way it doesn’t work, indeed. The option set settings are overridden by the settings for “all configurations”, which is a bit weird IMHO. You can achieve the correct result when you drag the option set below the Debug and Release configurations.

  2. eduardo said

    Very well

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: