Ebuild : Extend of condition syntax support

To what extent are conditions supported in Ebuild.

From testing, $(Configuration) looks to work e.g.

<ItemGroup Condition="'$(Configuration)' == 'Debug'">

Something like this appears not to be, possibly always evaluating to true ?

<ItemGroup Condition="$(DefineConstants.Contains('NET_CLIENT'))">

I would like to be able to achieve the latter if possible (due to some odd behaviour with high dpi and Hydra plugins in a Delphi Host).

I basically need to include a set of files (A) if a Winforms .Net plugin is going to be hosted in a Delphi Host and set of files (B) if it is to be instantiated from a .Net host.

I’ve seen a post from a few years ago, but nothing else relevant :-

Is this possible with EBuild ?

Not at all.

EBuild merely uses this syntax for MSBuild backwards-compatibility to mark each Configuration’s settings group (and uses the same for Targets, an EBuild-exclusive feature), but does not actually parse or process these as conditions.

You can set the “Conditional” property on the individual file item, and it will be based to the compiler; I am not entirely sure, but “Conditional:” should be able to take the name of a define (for sure) and possibly even a more complex set of conditions (as valid inside an {$IFDEF or the file’s language equivalent) – but I;'m not 100% sure on the last part, you;'d need to test.

  <Compile Condition="NET_CLIENT">NetOnly.pas</Compile>

Note that in your specific case, kid you have a multi-target project, you could also make a group of files specific to a target, eg

<ItemGroup Condition="$(Target) == 'MY_NET_CLIENT_TARGET">

where MY_NET_CLIENT_TARGET would be the name of your target.

Thanks Marc.

After a little more testing, I think I’m going with $(Configuration) in the ItemGroup. So we’ll have ReleaseDelphi and ReleaseNET configurations. The changes to all the projects are then straightforward.

1 Like