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
Like this:
Like Loading...