improve target platform detection when building SenseGloveConnectImpl and SenseGloveCoreImpl modules and also distinguish x64 builds from arm64 on windows

This commit is contained in:
Mamadou Babaei
2024-05-15 04:43:34 +02:00
parent 42cf764475
commit c6f0a172ab
2 changed files with 43 additions and 39 deletions
@@ -85,7 +85,14 @@ public class SenseGloveConnectImpl : ModuleRules
string LibraryPathAnroidx64 = "";
string LibraryName = "sgconnect";
if (Target.Platform == UnrealTargetPlatform.Android)
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
Target.WindowsPlatform.Architecture == UnrealArch.X64;
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (bIsAndroid)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
@@ -95,7 +102,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryName = string.Format("lib{0}.a", LibraryName);
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
else if (bIsLinux)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -112,11 +119,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
}
#if UE_5_0_OR_LATER
else if (Target.Platform == UnrealTargetPlatform.LinuxArm64)
#else
else if (Target.Platform == UnrealTargetPlatform.LinuxAArch64)
#endif
else if (bIsLinuxArm64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -133,7 +136,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
}
else if (Target.Platform == UnrealTargetPlatform.Win64)
else if (bIsWin64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
switch (Target.WindowsPlatform.Compiler)
@@ -163,11 +166,9 @@ public class SenseGloveConnectImpl : ModuleRules
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (Target.Platform == UnrealTargetPlatform.Android)
if (bIsAndroid)
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
@@ -186,7 +187,7 @@ public class SenseGloveConnectImpl : ModuleRules
}
else
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
}
@@ -210,7 +211,14 @@ public class SenseGloveConnectImpl : ModuleRules
string LibraryPathAnroidx64 = "";
string LibraryName = "serial";
if (Target.Platform == UnrealTargetPlatform.Android)
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
Target.WindowsPlatform.Architecture == UnrealArch.X64;
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (bIsAndroid)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
@@ -220,7 +228,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryName = string.Format("lib{0}.a", LibraryName);
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
else if (bIsLinux)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -237,11 +245,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
}
#if UE_5_0_OR_LATER
else if (Target.Platform == UnrealTargetPlatform.LinuxArm64)
#else
else if (Target.Platform == UnrealTargetPlatform.LinuxAArch64)
#endif
else if (bIsLinuxArm64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -258,7 +262,7 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
}
else if (Target.Platform == UnrealTargetPlatform.Win64)
else if (bIsWin64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
switch (Target.WindowsPlatform.Compiler)
@@ -288,11 +292,9 @@ public class SenseGloveConnectImpl : ModuleRules
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (Target.Platform == UnrealTargetPlatform.Android)
if (bIsAndroid)
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
@@ -311,7 +313,7 @@ public class SenseGloveConnectImpl : ModuleRules
}
else
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
}
@@ -84,7 +84,14 @@ public class SenseGloveCoreImpl : ModuleRules
string LibraryPathAnroidx64 = "";
string LibraryName = "sgcore";
if (Target.Platform == UnrealTargetPlatform.Android)
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
Target.WindowsPlatform.Architecture == UnrealArch.X64;
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (bIsAndroid)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
@@ -94,7 +101,7 @@ public class SenseGloveCoreImpl : ModuleRules
LibraryName = string.Format("lib{0}.a", LibraryName);
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
else if (bIsLinux)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -111,11 +118,7 @@ public class SenseGloveCoreImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
}
#if UE_5_0_OR_LATER
else if (Target.Platform == UnrealTargetPlatform.LinuxArm64)
#else
else if (Target.Platform == UnrealTargetPlatform.LinuxAArch64)
#endif
else if (bIsLinuxArm64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
@@ -132,7 +135,7 @@ public class SenseGloveCoreImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
}
else if (Target.Platform == UnrealTargetPlatform.Win64)
else if (bIsWin64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
switch (Target.WindowsPlatform.Compiler)
@@ -151,6 +154,7 @@ public class SenseGloveCoreImpl : ModuleRules
Debug.Assert(false, "Unsupported engine version or compiler!");
break;
}
LibraryName = string.Format("{0}.lib", LibraryName);
}
else
@@ -161,11 +165,9 @@ public class SenseGloveCoreImpl : ModuleRules
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (Target.Platform == UnrealTargetPlatform.Android)
if (bIsAndroid)
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
@@ -184,7 +186,7 @@ public class SenseGloveCoreImpl : ModuleRules
}
else
{
if (bDebug)
if (bIsDebugBuild)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
}