mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00

Added PICLevel, RelocKind DarwinCommon/LinuxCommon/AndroidCommon merged into PosixCommon Mangling changed to avoid '@'
55 lines
897 B
Beef
55 lines
897 B
Beef
using System;
|
|
|
|
namespace IDE.Util
|
|
{
|
|
class TargetTriple
|
|
{
|
|
public static bool IsTargetTriple(StringView str)
|
|
{
|
|
int dashCount = 0;
|
|
for (let c in str.RawChars)
|
|
if (c == '-')
|
|
dashCount++;
|
|
return dashCount >= 2;
|
|
}
|
|
|
|
public static Workspace.PlatformType GetPlatformType(StringView str)
|
|
{
|
|
var str;
|
|
|
|
// Remove version from the end
|
|
while (!str.IsEmpty)
|
|
{
|
|
char8 c = str[str.Length - 1];
|
|
if ((c.IsDigit) || (c == '.'))
|
|
str.RemoveFromEnd(1);
|
|
else
|
|
break;
|
|
}
|
|
|
|
bool hasLinux = false;
|
|
|
|
for (let elem in str.Split('-'))
|
|
{
|
|
switch (elem)
|
|
{
|
|
case "linux":
|
|
hasLinux = true;
|
|
case "windows":
|
|
return .Windows;
|
|
case "macosx":
|
|
return .macOS;
|
|
case "ios":
|
|
return .iOS;
|
|
case "android",
|
|
"androideabi":
|
|
return .Android;
|
|
}
|
|
}
|
|
|
|
if (hasLinux)
|
|
return .Linux;
|
|
return .Unknown;
|
|
}
|
|
}
|
|
}
|