Closed cmello closed 8 months ago
Hello,
I extracted some code from our scripts... Removed the things that are under nda.
static class Extensions
{
public static string ToPlatformString(this Platform platform)
{
switch (platform)
{
// Used by buildsystemhelper, need to target value in Pipeline.Core/Targets.cs
case Platform._reserved8: return "<removed the name> - Put the name here";
case Platform._reserved7: return "<removed the name> - put that other name here";
}
return platform.ToString();
}
}
We also have this
class EngineTarget : ITarget
{
public Platform Platform;
public string PlatformString
{
get
{
if (Platform == SomeHiddenPlatform.SharpmakePlatform)
return "somestring";
if (Platform == Platform.XXXX)
return "XXX";
if (Platform == XYZ.SharpmakePlatform)
return "xyz";
return _platformString ??= Platform.ToString();
}
}
}
Thank you!
Hi,
When working with custom platforms that map to
__reserved
entries of theSharpmake.Platform
enum, is there a recommended way to get the platform name?I believe one way to get the mapping would be querying the
PlatformRegistry
, to obtain the platform implementation type and then get itsSimplePlatformString
. However, theQuery<TInterface>(Platform platform)
method of thePlatformRegistry
class requires the caller to know the type of the interface to get (given in its generic argument). Link to code: https://github.com/ubisoft/Sharpmake/blob/main/Sharpmake/PlatformRegistry.cs#L417-L425Could you please suggest an alternative method to get the platform name, or may I contribute a PR to add one more Query method that does not require passing the platform interface type?
Thank you!
Best regards, Cesar