The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 4,262 other subscribers

Delphi: .dproj TargetedPlatforms bit flags in main PropertyGroup, and Platform values in other elements/attributes

Posted by jpluimers on 2021/06/09

For cleanup of .dproj files, I want to know the bit flags that TargetPlatforms can have.

TL;DR: .dproj content management in Delphi is a mess

For future reference empiric values for the flags that build the TargetedPlatforms (not to be confused with PlatformTargets) element content in the main PropertyGroup of a .dproj file in a table.

This might help creating an XSD for a .dproj file (Source: Reminder to self: make a start for an XSD that validates Delphi dproj files).

Absent cells means I have no idea if the values are relevant or what they could be.

Input for those is more than welcome.

Bit# TargetedPlatforms bit flag value Platform and $(Platform)value Meaning (dropdown value of “Select Platform” dialog)
0 1 Win32 32-bit Windows
1 2 Win64 64-bit Windows
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024 iOSDevice64 iOS Device 64-bit
11 2048
12 4096

($Platform) values still to cover:

  • Android
  • Linux64
  • OSX32
  • iOSDevice32
  • iOSSimulator

There is only one place for TargetedPlatforms in the .dproj file: at the XPath /Project/PropertyGroup/TargetedPlatforms.

For getting the XPath, I used Notepad++ as described in my earlier blog post Getting the path of an XML node in your code editor.

It has the combined flags, so:

  • 3 means Win32 and Win64 are enabled
  • 1025 means Win32 and iOSDevice64 are enabled

The Platform value (and thus $(Platform) value) is the one used in for example these elements or attributes:

  • /Project/PropertyGroup/Platform as currently selected platform
  • /Project/PropertyGroup/@Condition as selectivity expression, for instance
    •  <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
    • <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
  • /Project/ProjectExtensions/BorlandProject/Platforms/Platform (all having for the value property with the Platform value) having a content of either True or False.
    • This allows a .dproj file to contain information for platforms that are not visible yet.

The actual values of Platform also play a role in these places:

  • /Project/PropertyGroup/Base_Win64 containing the base settings for the Win64 platform so they can be derived for the Debug or Release builds.
  • /Project/PropertyGroup/@Condition for instance <PropertyGroup Condition="'$(Base_Win64)'!=''">
  • /Project/ProjectExtensions/BorlandProject/Deployment/DeployFile/Platform/@Name for instance <Platform Name="iOSSimulator">

Even worse: there are unneeded  nodes present for bits in TargetPlatforms and /Project/ProjectExtensions/BorlandProject/Platforms/Platform being absent or having a content False for /Project/ProjectExtensions/BorlandProject/Platforms/Platform/@value other than the enabled bits in TargetPlatforms, for instance:

  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/DeployFile/Platform
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/ProjectRoot/@Platform
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/DeployClass/Platform/@Name (and the parent DeployClass subtrees)
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Platforms/Platform@value

Some examples of superfluous nodes when TargetPlarforms has a value of 1 (corresponding to Platform having a value of Win32:

<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>

Also, non relevant platforms are included in this node:

<Platforms>
    <Platform value="Win32">True</Platform>
    <Platform value="Win64">False</Platform>
</Platforms>

The Deployment section is even worse; see for instance [WayBack] delphi – How manage or clean deploy section in dproj files? – Stack Overflow.

–jeroen

One Response to “Delphi: .dproj TargetedPlatforms bit flags in main PropertyGroup, and Platform values in other elements/attributes”

  1. uweraabe said

    The TargetPlatform bits are declared in System.Classes:

    { Platform identifiers }
    pidWin32 = $00000001;
    pidWin64 = $00000002;
    pidOSX32 = $00000004;
    pidiOSSimulator32 = $00000008;
    pidiOSSimulator = pidiOSSimulator32 deprecated ‘Use pidiOSSimulator32’;
    pidAndroid32Arm = $00000010;
    pidAndroid = pidAndroid32Arm deprecated ‘Use pidAndroid32Arm’;
    pidLinux32 = $00000020;
    pidiOSDevice32 = $00000040;
    pidiOSDevice = pidiOSDevice32 deprecated ‘Use pidiOSDevice32’;
    pidLinux64 = $00000080;

    pidWinNX32 = $00000100;
    pidWinIoT32 = $00000200; // Embedded IoT (Internet of Things) Windows w/ Intel Galileo
    pidiOSDevice64 = $00000400;
    pidWinARM32 = $00000800;
    pidOSX64 = $00001000;
    pidLinux32Arm = $00002000;
    pidLinux64Arm = $00004000;
    pidAndroid64Arm = $00008000;

    pidiOSSimulator64 = $00010000;

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.