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:
AndroidLinux64OSX32iOSDevice32iOSSimulator
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:
3meansWin32andWin64are enabled1025meansWin32andiOSDevice64are enabled
The Platform value (and thus $(Platform) value) is the one used in for example these elements or attributes:
/Project/PropertyGroup/Platformas currently selected platform/Project/PropertyGroup/@Conditionas 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 thevalueproperty with thePlatformvalue) having a content of eitherTrueorFalse.- This allows a
.dprojfile to contain information for platforms that are not visible yet.
- This allows a
The actual values of Platform also play a role in these places:
/Project/PropertyGroup/Base_Win64containing the base settings for theWin64platform so they can be derived for theDebugorReleasebuilds./Project/PropertyGroup/@Conditionfor instance<PropertyGroup Condition="'$(Base_Win64)'!=''">/Project/ProjectExtensions/BorlandProject/Deployment/DeployFile/Platform/@Namefor 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 parentDeployClasssubtrees) - 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






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;