mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 00:50:25 +02:00
Added Android support, and generalized target triple support
Added PICLevel, RelocKind DarwinCommon/LinuxCommon/AndroidCommon merged into PosixCommon Mangling changed to avoid '@'
This commit is contained in:
parent
7a27ab75bf
commit
3883a3674d
39 changed files with 3457 additions and 5636 deletions
55
IDE/src/util/TargetTriple.bf
Normal file
55
IDE/src/util/TargetTriple.bf
Normal file
|
@ -0,0 +1,55 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue